A quick website tool. Run the nim file and access your webpage. Website: https://nimwc.org
- 1 Click Blogging posts directly from browser.
- 1 Click Static web pages directly from browser.
- WYSIWYG & Drag'n'Drop Editors with Summernote, CodeMirror or GrapesJS.
- Custom title, meta description and keywords for each page, SEO friendly.
- Custom head, navbar and footer, no hardcoded watermarks, links or logos.
- Upload files and images (private or public) directly from browser.
- 1 language for the whole stack, including high performance modules, scripting, devops, deploy, from WebAssembly to Assembly.
- Self-Firejailing Web Framework (It Firejails itself) Best Linux Security integrated on the Core.
- 2 Factor Athentication TOTP
- ReCAPTCHA
- HoneyPot-Field
- BCrypt+Salt password hashing
- SQL Type-checked and Query-checked at compile-time, no SQL injections.
- Multiple users with different ranks, role based access control.
- Admin can choose how much CPU & RAM NimWC can use from the Admin Dashboard.
- We recommend FreeOTP 2 Factor Athentication App because is Open Source.
- Edit core or custom JS and CSS directly from browser, UI/UX Designer friendly.
- Log Viewer directly from browser.
- Auto-Rotating file Logger.
- Server Info Page for Admins.
- Force Server restart for Admins.
- Edit main config file directly from browser
- Recompilation without down times.
- Webserver hosting your page on 127.0.0.1:7000
- Colored output on the Terminal.
- Email notification on critical errors.
- Plugin Store integrated
- Enable and disable plugins directly from browser. Open Source or Private Plugins.
- Plugin skeleton creator to create your own new plugins.
- Plugins can do anything you want on Frontend and Backend.
- Develop your own plugins - NimWC plugin repository
- Postgres (if you are using the NimWC docker file, you do not need to install Postgres)
- SQLite
- High performance with low resources (RPi, VPS, cloud, old pc, etc).
- Runs on any non-Windows OS, Architecture and Hardware that can compile C code.
- Independent TechEmpower Benchmarks show Nim web server as one of the fastest in the world.
- High Availability design by default.
- Full Stack with the same programming language, including DevOps and Scripting.
- 0 Dependency binary (Postgres/SSL/WebP/Firejail required if using it).
- No
/node_modules/
, but very powerful builtin Templating engine. - Compile-Time precomputed arbitrary function execution is used when possible.
- No Global Interpreter Lock, no single-Thread, no single-Core, no Interpreter. Use all your 32 CPU Cores.
- Uses responsive Bulma CSS framework, supports Bootstrap CSS framework.
- JavaScript framework agnostic, use Nim, Karax, vanilla JS, you choose.
- WebP automatic Image and Photo Optimizations.
- NGINX Config template.
- SystemD Service template.
- Vagrantfile template.
- Dockerfile template.
To get started you only need:
- Linux (For Windows see Docker-for-Windows)
- Nim >=
0.19.2
Development dependencies (automatically installed by Nimble):
- Jester >=
0.4.1
- reCAPTCHA >=
1.0.2
- bCrypt >=
0.2.1
- datetime2human >=
0.2.2
- otp >=
0.1.1
- firejail >=
0.4.0
- webp >=
0.1.0
Foreing dependencies:
- webp (libwebp)
- firejail >= 0.9.58
To compile and install you need Nim. You can easily install Nim using choosenim with:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
You only need to perform 1a or 1b - not both of them.
# Install nimwc with nimble
nimble install nimwc
# Edit the config.cfg accordingly
# (change the confg.cfg path to your nimble folder and the correct package version)
nano ~/.nimble/pkgs/nimwc-5.0.0/config/config.cfg
# Run nimwc
# (to add an Admin user append "newuser": nimwc --newuser -u:admin -p:pass -e:[email protected])
# (to include some standard pages: nimwc --insertdata)
nimwc
# Login
127.0.0.1:7000/login
This will generate the executable in the folder.
# Clone the repository
git clone https://github.com/ThomasTJdev/nim_websitecreator
cd nim_websitecreator
# Generate and edit the config.cfg accordingly
cp config/config_default.cfg config/config.cfg
nano config/config.cfg
# Install dependencies
nimble install jester recaptcha bcrypt datetime2human otp firejail webp
# Compile nimwc
nim c nimwc.nim
# Run nimwc
# (to add an Admin user append "--newuser": ./nimwc --newuser -u:admin -p:pass -e:[email protected])
# (to include some standard pages: nimwc --insertdata)
./nimwc
# Login
127.0.0.1:7000/login
These arguments should be prepended to executable file, e.g. ./nimwc cdata
--newuser
= Add the Admin user. The-u:<username>
,-p:<password>
and-e:<email>
args are required. E.g.--newuser -u:admin -p:pass -e:[email protected]
-u:<admin username>
-p:<admin password>
-e:<admin email>
--insertdata
= Insert standard data (this will override existing data)bulma
= Use Bulma CSSbootstrap
= Use Bootstrap and jQueryclean
= No framework is used
--newdb
= Generates the database with standard tables (does not override or delete tables).newdb
will be initialized automatic, if no database exists.--gitupdate
= Updates and force a hard reset--initplugin
= Create plugin skeleton inside tmp/
These options are only available at compiletime:
-d:rc
= Recompile. NimWC is using a launcher, it is therefore needed to force a recompile.-d:adminnotify
= Send error logs (ERROR) to the specified admin email-d:dev
= Development-d:devemailon
= Send email when-d:dev
is activated-d:demo
= Used on public test site Nim Website Creator. This option will override the database each hour with the standard data.-d:gitupdate
= Updates and force a hard reset-d:postgres
= Use Postgres database instead of SQLite
There are 3 main user profiles:
- User
- Moderator
- Admin
The access rights below applies to main program. Plugins can have their own definition of user rights.
The "User" can login and see private pages and blog pages. This user has no access to adding or editing anything.
The "Moderator" can login and see private pages and blog pages. The user can add and delete users, but cannot delete or add "Admin" users. The user cannot edit JS, CSS and core HTML - only within the pages and blogposts.
The "Admin" has access to anything.
You can easily add and edit blogpages. The blogpages support metadata: meta description and meta keywords. It is also possible to specify a category and tags.
In the settings menu you can specify how your blogposts should be sorted, e.g. on modfied date in ascending order.
To only show blogpost with a specific name, tag or category, you have to append the criteria to the URL. It is not possible to combine these.
website.com/blog?name=nim
website.com/blog?category=article
website.com/blog?tags=code
Multiple plugins are available. You can download them within the program at <webpage>/plugins/repo
.
The plugin repository are located here: NimWC plugin repository
When editing a blogpage or a normal page press Ctrl+S to save.
GrapesJS is a Web Builder Framework. To use GrapeJS with a CSS framework (Bulma or Bootstrap), you have to edit public/js/grapejs_custom.js
and public/js/grapejsbs4.min.js
. Bootstrap support in public/js/grapejs_custom.js
is commented out.
Docker, Vagrant, SystemD Service, NGNIX, Admin stuff, etc
Docker
- Use the Dockerfile as starting point for your NimWC containers.
Vagrant
- Use the Vagrantfile as starting point for your NimWC VMs.
NGNIX Config
- Use the NGNIX Config file as starting point for your NGNIX Server configuration.
Google reCAPTCHA
To activate Google reCAPTCHA claim you site and server key and insert them into config.cfg
.
SystemD
- Use the SystemD Service file as starting point for your NimWC SystemD Services.
Copy the file called nimwc.service
inside /lib/systemd/system/
sudo nano /lib/systemd/system/nimwc.service
sudo systemctl enable nimwc
sudo systemctl start nimwc
sudo systemctl status nimwc
- Default settings will work Ok on most systems, sane defaults.
- Some settings are kind of technical, you should know some Linux Kernel related stuff.
- Links are provided on the Firejail config page when makes sense.
- You can harden your system even more by tweaking the Firejail config.
- You can always come back to the default settings and it will work Ok.
- Check that Firejail Status at bottom of the page is mostly green.
You can choose how much CPU & RAM NimWC can use, Firejail will make NimWC believe that theres less CPU & RAM that the actually physically available. If you choose too small resources for too big load, then it will feel like when you try to run a heavy program on a VirtualBox with too small CPU & RAM, but will still run, or do the best to try to run. This can be useful for Clouds that charge you extra when you pass certain threshold of CPU & RAM usage.
NimWC does not depend on any Hardware device to run, like audio, video, USB, DVD, etc, so you can block the access to the hardware peripehals, that also blocks its hardware drivers and libraries that may have vulnerabilities, making your NimWC more secure.
There are options to block root user and the rest of the users on the Linux system, thats help protect your NimWC against Privilege Scalations, thats when an unprivileged normal user becomes superuser root, or an user can see other users stuff.
Caches and Temporary directories are mounted as private temporary unique autogenerated TMPFS, meaning that the real ones can not be altered from within NimWC.
The features come from the Linux Kernel itself, so theres zero cost on performance and the technology is already there even if you use it or not.
So in conclusion NimWC being compiled binary wont need access to most of your system, just its own folder, the integration with Firejails hides everything else.
You local version of firejail to needs be >= 0.9.58. Install using your package manager:
# Arch (package manager)
sudo pacman -S firejail
# Ubuntu (built files)
https://launchpad.net/ubuntu/+source/firejail/0.9.58-1 # <-- download
sudo apt install ./firejail_0.9.58-1_arm64.deb
# Compile
git clone https://github.com/netblue30/firejail.git
cd firejail
./configure && make && sudo make install-strip