FOMO is a TypeScript app running on top of Node.js. We are using Next.js as our web framework. React.js is handling our frontend templating and we are using Next.js' built in API routes to handle our servers JSON responses. Our data layer is built using PostgreSQL and Prisma.
This project uses ESLint and Prettier to enforce code style and linting and formatting commands
are run in a git pre-commit hook using Husky. In order to use this tool with your local VSCode
source control you can add a ~.huskyrc
with the following contents:
# ~/.huskyrc
# This loads nvm.sh and sets the correct PATH before running hook
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
-
Set up
.env
file with a:DATABASE_URL=postgresql://<db_user>:<db_password>@<db_name> CLOUDINARY_URL=<cloudinary_api_url>
-
Run
npm install
-
Run
npx prisma db migrage
-
Run
npx prism db seed
-
Run
npm run dev
FOMO is currently protected and cached on Cloudflare. Sitting behind Cloudflare we have a Caddy serving as a reverse proxy in front of our app as well as providing ssl certification. Our production build app is running in a Docker container networked to a postgres container using Docker-Compose.
To deploy this app:
-
Setup server with a reverse proxy in front of port 8002
-
Git pull application to server in the
srv
folder -
cd
into the application folder -
Create a
.env.production
containing:SECRET_KEY=<secret_key> DATABASE_URL=postgresql://<db_user>:<db_password>@<db_name> CLOUDINARY_URL=<cloudinary_api_url>
-
Create a
.env.production.db
containing:POSTGRES_USER=postgres POSTGRES_DB=postgres POSTGRES_PASSWORD=postgres
-
Create and seed database:
- run
docker-compose -f docker-compose-db-setup.yml build
- run
docker-compose -f docker-compose-db-setup.yml up
- run
-
Build production app:
- run
docker-compose build
- run
docker-compose up
- run
-
Prosper!