LostMVC was a project I’ve worked on in my spare time between 2014 and
2016.
It’s essentialy a web framework built from scratch using Tcl and the
NX/NSF Next Scripting Framework https://next-scripting.org/xowiki/
built and optimized specially for NaviServer.
NSF and NX
To understand the full potential of
LostMVC
and Codru we first have to analyze the
Next
Scripting Framework for which I’ve written more on a different page.
NaviServer
NaviServer has a long history, longer than Apache’s history. NaviServer was built by NaviSoft way back in 1993, acquired by AOL in 1995
It combines everything a modern wbeserver needs with builtin functions.
It’s support for Tcl as the per defautl programming language.
Although one could easily add PHP.
One of it’s cool features is a pooled database connection system which
maintains a pool of connections for your prefered database.
Data Share between threads via protected variables and caches. Threads
are isolated with each it’s own unique Tcl interpreter so no threading
issues here.
And many more things…
LostMVC - Codru core features
MVC Structure
Modules
Modules holding Models, vieews, controllers
Validation on server and on client side
Write once use everywhere.. Simple Model validation on client side and
also automatically done on server side.
Easy integrated flash messages for errors on forms.
Controllers
Pre and Post action functions that run automatically.
Views
Thanks to the HTML generation most of the view functions are
simplified.
FORM generation
Gridview and Listview modules supporting: pagination, sorting,
searching, caching, model integration
Code Generation
You write SQL then the code generator creates your Model upon which you can use as input so the project build a full controller with views.
SQL Mapping
Something similar to Active Record
RBAC Role Based Authorization Control
Any good web framework needs a RBAC system.
A great framework has a interface for it.
Authorization could be controled using basic roles.
A role item can be a parent or a child. Users can have roles assigened
to them.
Different roles based on the controller/module.
Guest roles, authenticated roles, and of course super admin roles are already provided by default.
Sub roles
Included Authorization and Authentication
Included Authorization and Authentication.
Register and Login pages that where fully extensible.
Security settings which included
Login limiting and protection
Password recovery limiting
Registration protection system
HTML and Javascript
HTML generation
Simple generation of HTML without having to write HTML.
Links, lists, alerts, tables, forms,labels, inputs, jumbotron,
breadcrumbs, checkboxes, radioboxes, dropdowns.
Navigation and menu generation, panels, tabs, modals, tooltips, carousel
and image galleries etc..
Font awesome integration.
Automatic pagination
HTML/CSS/JS plugins integration. Automatic style/link insertion in the
page based on the functions you used.
Form generation based on the specific needs.
HTML/CSS/JS plugins
Integrated plugins which can be easily used. Automatic javascript
includer ONLY if the feature is used on a page.
Caching and JS lazy loading included!
datetimepicker
datepicker
editable text (clickable text that becomes editable)
select2
prettycheckboxes
bootstrap toggle
ckeditor
markdown
Image Gallery
HubSpot messenger
Highcharts
Contextmenu
Slider
Countdown
lazy loader
Bootstrap wizard
jsPDF PDF generation
Syntax highlighter for code
fileinput
rating stars
Drag and drop
Session
Since naviserver nor tcl provided a session management system like the
one in PHP I had to copy and implement my own session management
system.
It worked in flat files but could easily have been extended to memory or
database.
Caching
Powerful caching. Half of the work was done by the Naviserver internals
API.
Caching SQL queries, portions of pages, or full pages. Options to cache
in memory and/or as a file on disk.
Fastpath caching of CSS/JS files that are cached in RAM and are handled
by different threads/processes.
This really speeds up everything.
Multi Language support and detection
Built in support for multi language support using msgcat (tcl
package).
Detecting favourite language could be tweaked for each app based on a
succession of the following:
OS/Browser language, Location, Cookie/session
Default fallback to specified language user based configuration.
Huge uploads
NaviServer
can be tweaked for anything. So I tweaked it to allow uploads of huge
files.
This meant even if your ram was limited (say 1 GB) you can still upload
a 10 GB file without any issue.
Recycle Bin
The known issue of UI/UX "Are you sure you want to delete this?"
I’ve built a Recycle Bin special table which keeps all deleted data from
models.
THis way a undo can easily be done at anytime without the end user even
noticing anything.
When deleting anything via the built in controller you can easily undo any "accidental" deletion.
All the developer has to do is show the user a link to it. Or create a
page of recently deleted items.
A daily script can be used to delete things that haven’t been recovered.
Command line management
Simple commandline code generation and management. (see tcl/installer.tcl)
Tags
Tags are powerful. Builtin tags are even more powerful. This way you can tag anything.
Mail integration
Since naviserver didn’t have a php mail function I needed to use SMTP
services for mail sending.
So if I needed to implement SMTP then why not integrate services like
mandril?
Builtin Profile and User management
User registration and management was not an afterthought it was the
basic need for any system.
User creation, login, password management, forgotten password, e-mail
activation.
Login attempts and reset attempts limiting by blocking the user
temporarily.
What do you do when you need to add another user field to the
database?
Do you modify the whole database? I sure hope not.
NO, you just use a few special tables and a good crafted script. This
way you can add as many fields as you want anytime
Without negative impact to the overal working of the system.
I’ve built a system for admins of websites to be able to add profiles
for users on the fly without any code.
This way if your app needs information about a user’s birthdate or
favourite food you don’t need to modify the whole system.
Self installer
There was no yum install, nor any apt-get install for anything except
Tcl.
So I had to manually (cross)compile everything myself.
This included Naviserver, the Next Scripting Framework
and all of the extra modules nsdbi, nsdbilite, nsdbipg.
Also manual setup of postgresql and the whole system.
This cumbersome work was needed for every naviserver installation.
Since i didn’t like to clone VPSes i needed to do it every time.
i eventually built a self contained script using tclkit and cookit that
does the installation and configuration for me.
This includes downloading, compiling and setting up the services
necesary.
Not to mention each step could be configured by the user while
installing or a fully unattended install.
Projects I’ve built using LostMVC.
Please note that none of these are available anymore.
The project has been abandoned and so have the projects built with
LostMVC.
Some of them have been rewritten, others have also been abandoned:
Read more here
The
LostMVC project is officialy abandoned - Reasons and what I’ve learned
E-Commerce Online Shop Platform
I’ve started working on a E-Commerce Shop Platform for LostMVC. A fair amount of work had been done and it had features of world renowned shops.
Blog and Content Management System (CMS)
One thing that bothered me is that there are great frameworks out there
but no builtin CMS/Blogging system for them.
I mean evena basic one would suffice. I know you’re supposed to build
one yourself.
So I did build a basic Blog/CMS system that used tinymce.
It supported tags, comments and posts.
Every Second Matters - A time tracking application
A simple time tracking application which I’ve built to track time on
projects and tasks.
Works great with tags
Personal GoldBag
Personal finance manager which can give you a clear overview of
expenses.
Uses highcharts.js for the drawing of charts.
bibliography.info
Not online anymore
But you ca view a temporary snapshot from the wayback machine.
Note that the wayback machine didn’t manage to create a snapshot of the
CSS/images due to a specific trick I used to avoid leeching of
CSS/images.
https://web.archive.org/web/20161001054213/http://bibliografie.info/ro/lucrare/index
LifeBeyondApocalypse.net -
This is a PBBG (Persistent Browser Based Game) I’ve developed in the
past.
The first version was for a Websh Apache Module. It was developed
between 2007 and 2008 before I went to college.
The second version was for the Codru LostMVC web framework that I had
developed between 2014-2015.
I;m currently working on an Elixir version for the purpose of learning
OTP.
United brain Power - Website
A snapshot of it can be found here:
https://web.archive.org/web/20161006203229/http://unitedbrainpower.com/
Open Source
Yeah, I’ve always considered once I open source something then it’s open
for everyone to see and judge.
And I didn’t want to pollute the open world with my coding learning
mistakes.
But after reading other people’s code I now think that NO ONe should
publish any code unless a team of highly esteemed programmers reviews
it.
But if you’re interested in the source code, you can find a ZIP of it
all right here.
I’ve used fossil as the SCM.
A bundle containing the E-Commerce, Blog / CMS and the 3 projects , Every Second Matters, Personal Goldbag
If you compile naviserver with the prequisitories and then install LostMVC/Codru you can then copy the projects and view them
Maybe one day, for historical purpose i might install a Virttual
Machine one more time to showcase what LostMVC codru framework was all
about
Maybe even make a small video of the usage of the projects & convert it
to a GIF.
Someday? Call me maybe?
Oh, just before you download it, I’d like an e-mail address :D You know,
so I know who My audience is.
I wouldn’t want old pops to download it thinking it’s some kind of old
relicv…
Conclusions
Building and maintaining such a huge project taught me many valuable
lessons in programming, devops, linux management etc.
Would I build such a framework again? No. I’d use a robust and powerful
framework like Phoenix instead.