Latticelium is designed for managing json files with a Web or Electron user interface.
- API
- UI
- Desktop App
- Jsonsets Collection
- Prerequisites
- Build All
- Start Server and open static UI
- Electron
- Build and Start API only
- Run UI locally
Latticelium-API consists of a RESTful API that performs CRUD updates to a mongodb database on the backend using express + mongoose.
After starting the API server, all CRUD actions can be performed against your MongoDB database.
We have included a static UI to send HTTP requests to your RESTful API using Axios XMLHttpRequests via the browser.
This project also includes an Electron build to combine the API and UI in one simple desktop application, with Windows, MacOS and linux builds.
This MongoDB Collection is designed to manage json data with a title and description as the first of many collections I plan to build out in this project.
This project depends on node.js ( using v18.14.0 LTS at the time of writing this ) and has all the included libraries in the two package.json files for client and server along with the build/run scripts.
You can have a local instance of MongoDB running, setup remotely or both.
After testing with a basic MongoDB in localhost, you can also create a remote instance by adding the extra security and admin.
- go to https://www.mongodb.com and find install steps for your OS
- follow install steps
- access Mongo Shell and create Admin user, follow security steps for your version of MongoDB and environment
- Create your Admin user ( change user_name to your choice )
- example creating the user...
-
db.createUser( { user: "user_name", pwd: passwordPrompt(), roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] } )
- In Mongo Shell, enter
use jsonsets
to generate the empty Collection you will be using exit
to leave Mongo Shell
- Here is an example of how I established access on my Ubuntu Server, but you will likely have do some research as MongoDB has many ways to wire up your database properly depending on the environment and versions used.
sudo vim /etc/mongod.conf
to add your IP as ip_of_mongo_server and add security enabled-
net: port: 27017 bindIp: 127.0.0.1,ip_of_mongo_server
-
security: authorization: enabled
sudo systemctl restart mongod
-
NOTE: I have found you can also create out-of-the-box MongoDB servers without any experience using DigitalOcean, Azure or AWS at a little higher cost if having trouble configuring your connections and security.
- copy
credDB.json.SAMPLE
tocredDB.json
- add user and pass
- note: this is so we don't store the user/pass in the repo
- set USE_CRED to true
- note: turned off in case you are using local DB to toggle production on/off for testing. This does not use a user/pass for local, so you would need to refactor path in the
api/app/config/db.config
if anything different setup locally.
- note: turned off in case you are using local DB to toggle production on/off for testing. This does not use a user/pass for local, so you would need to refactor path in the
- replace
127.0.0.1:27017
incredDB.json
with yourip
ordomain
of your MongoDB Server. Include port number unless changed or not needed.
npm run build_all
- this builds all the UI (+ electron) and API node_modules.
This installs all your npm dependencies.
npm start
This starts your RESTful API server and opens the local static UI in your default browser.
npm run dist_win
Windows .exenpm run dist_mac
MacOSnpm run dist_linux
Linux
These scripts will generate an executable that you can run anytime or even share. Do some deeper investigations if looking to establish security as this is more of a proof of concept.
npm run start_electron
- if all goes well you should see the Electron app open locally, running off the index.js file as your client side application.
This script automatically starts the RESTful API server as well and makes the database connection.
cd api
npm run build_api
npm start
( available on port 8080 )
- Make sure the API is running to establish connection
- Manual Option
- manually open
index.html
located at/ui/index.html
in your browser
- manually open
- Auto Option
- from the root directory
npm run open
- from the root directory