This is a template for an Express.js application. It includes a basic setup for a REST API with a user model and authentication.
This template uses .ejs for the front end
- Analytics (Posthog)
- User Authentication (PassportJS)
- Database (PostgreSQL)
- Payments (Stripe)
- Logging (Pinojs)
- testing - Playwright?
Product Analytics
-
Front end
-
Posthog
-
Google Analytics
-
Google Tag Manager
-
Openreplay
-
Back end
- Posthog
Logging is done with Telegram
Visualizing logs is done in telegram chat
- Recomended is Koyeb - Has a free instance
PostgreSQL
The web app is contained and can be built from a Docker image and hosting it in Docker Hub
The server can be run either via:
-
Docker compose config from the server directory
-
Standalone app via own npm command
-
npm run start:localWill start the nodejs server outside of docker using the.envfile -
npm run start:dockerwill runDocker composeusing the command and spawn the server + associated services (eg: Database) using thecompose.yamlfile
Docker compose is configured so the server will auto rebuild on code changes, so there is no need to close and reopen the server manually
NOTE: Currently the web app is not included in compose, so the front end has to be spawned from its own repository
Deployments are triggered by pushing or merging to next and latest branches.
When new code is pushed to either branch, Github Actions will:
- Build a the Docker image for the LATEST branch
- Upload the build image to Docker Hub
- Create or update the secrets in Koyeb using Github Secrets
- Run & deploy the Docker image in Koyeb's Infrastructure
Koyeb - easy to configure & serverless infrastructure running on AWS under the hood
The publicly available branches - next & latest - are served using ExpressJS
Environmental variables are injected at runtime by Koyeb, and they are set per-service (eg: next, latest) in Koyeb Project Configuration Environmental Variables configuration
Direct access to services in Koyeb:
An example list of env variables can be found in .env.example in the root directory
Stripe client for debugging can be started with npm command npm run stripe:listen
All the up-to-date documentation can be found in the swagger.yaml file
- All permissions are strict and handled via users and groups in AWS IAM Console