Mostly something to tinker on in my free time using tools I find online, or languages I had an idea in or something I wanted to learn better.
The end goal is to have a singular headless application with a separate web app UI that can control smart home devices, handle geolocation, schedule events, manage choosing a meal schedule for the week and/or anything else that strikes my fancy.
Prerequisites:
- node
- golang
- docker
- overmind
To install (all-in-one):
$ git clone https://github.com/seanlowe/nox.git
$ cd nox
$ ./install.sh
You can also install things manually, if you so desire. Here's a doc on that process. Also in that document are links to all of the prereq's for easy access.
After installation has finished, you'll want to create your .env
file. I have included an .env.example
with default values that you can change to your liking.
To run nox (in dev mode) once you've set it up to your liking, run:
$ overmind start
This will start two processes:
npm run dev
- checks to see if a new database needs creating or if we can start an existing one
- makes sure the database is up to date by running any migrations and seeders necessary
- then starts the Next.js dev server
go run ./noxd.go
- starts the Golang backend process
The app will be served at localhost:5100/
. You can quit the app by running overmind q
or pressing Ctrl+C
in the terminal where overmind is running.
Note: Optionally, you can choose to create a persistent instance of nox using PM2. If that's something you'd like to do, see running with PM2. This guide is outdated and needs updating. Please be patient.
This project uses Prisma and Schemix to control database structure and upper/db for database access from golang.
In order to make a lasting change on the database or update it with newly created models, run:
# build schema.prisma file from all schemix files
$ npm run db:mix
# run any migrations
$ npm run db:migrate
# generate the prisma client
$ npm run db:generate
This creates a schema.prisma file based on your models in ./prisma/models/
, updates the database with changes you've made to the schema, then generates a new Prisma Client for use in the project.
To view your DB in the browser, run:
$ npm run db:view
It will be served at localhost:5555/
I had many different modules built out in JS/TS but none of them were connected in a way that's feasible for consistent use. As of right now, I'm keeping around a few of the ones which were a little more built out in case I need to reference them again later.
Built on Next.js with Prisma. Runtime management via PM2 and overmind.