Getting started with SaaS Boilerplate
The primary objective of this boilerplate is to give you a production ready code that reduces the amount of time you would normally have to spend on system infrastructure's configuration. It contains a number of services that a typical web application has (frontend, backend api, admin panel, workers) as well as their continuous deployment. Using this boilerplate you can deploy multiple environments, each representing a different stage in your pipeline.
We don't create any new CLIs or APIs that you need to learn. We use existing solutions, which you can extend or change however you like:
- Make
- CDK (TypeScript)
- Serverless Framework
- Docker
#
Prerequisites- Install latest Node.js (with NPM >= 6)
- Install Python 3.8
We recommend installing Python using
pyenv
#
InstallationWe recommend cloning this repository instead of downloading the ZIP. This way you'll be able to merge latest changes without too much hassle by resolving conflicts using your favourite tools.
To setup the project and install local dependencies run following command:
#
Running locally#
Setup the local environment#
Adjust .env filesFiles with environmental variables are ignored in GIT to avoid secret values being commited and shared
with everyone. To make the app work as expected you need to initialize following .env
files from .env.example
files located in the same directories:
services/webapp/.env
– variables loaded by webpack when you run the local dev serverservices/workers/.env
– variables loaded by docker-compose when you invoke worker functions locallyservices/backend/.env
– variables loaded by docker-compose when you run the backend server locally
tip
This should be actually done automatically as part of the make setup
Now, adjust the key values that have to be set in the services/backend/.env
:
Name | Example | Description |
---|---|---|
DJANGO_DEBUG | True | docs |
DJANGO_SECRET_KEY | Zs639zRcb5!9om2@tW2H6XG#Znj^TB^I | docs |
HASHID_FIELD_SALT | t5$^r*xsMRXn1xjzhRSl8I5Hb3BUW$4U | docs |
ADMIN_EMAIL | admin@exmaple.com | Will be used to create first super admin user |
ADMIN_DEFAULT_PASSWORD | AvPZpabgj9Z8 | Will be used to create first super admin user |
STRIPE_TEST_SECRET_KEY | sk_test_1234 | you can get some here |
#
Run backend servicesFrom the repo's root directory, run:
This will run docker containers for all the backend services, in the detached mode.
Backend is running on http://localhost:5000
.
Backend endpoint docs are available on http://localhost:5000/doc
.
Admin Panel is running on http://admin.localhost:5000
.
Workers trigger server is running on http://localhost:3005
.
Mailcatcher is running on http://localhost:1080
. Check dedicated doc before using.
See the docker-compose.yml
file for the details.
Because these are running in the detached mode, to access the logs of the specific service, use:
#
Run webapp service#
Run docs serviceTo run this documentation locally: