Build the foundations for a Software as a Service business by leveraging Django, Tailwind, htmx, Neon Postgres, Redis, and more.
The goal of this project is to learn how to create a reusable foundation for building SaaS products. When release, this course will span multiple topics and give you a solid foundation into build your business.
- Deploy Django on Railway with this Dockerfile and guide
- Create a One-Off Secret Key for Django blog post
Thank you to Neon for helping bring this course to life!
mkdir -p ~/dev/saas
cd ~/dev/saas
git clone https://github.com/codingforentrepreneurs/SaaS-Foundations .macOS/Linux
python3 --version # should be 3.11 or higher
python3 -m venv venv
source venv/bin/activateWindows
c:\Python312\python.exe -m venv venv
.\venv\Scripts\activate# with venv activated
pip install pip --upgrade && pip install -r requirements.txtcp .env.sample .env
cat .envValues include:
DJANGO_DEBUG=1DJANGO_SECRET_KEY=""DATABASE_URL=""EMAIL_HOST="smtp.gmail.com"EMAIL_PORT="587"EMAIL_USE_TLS=TrueEMAIL_USE_SSL=FalseEMAIL_HOST_USER=""EMAIL_HOST_PASSWORD=""ADMIN_USER_EMAIL=""STRIPE_SECRET_KEY=""
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'or
openssl rand -base64 64or
python -c 'import secrets; print(secrets.token_urlsafe(64))'Once you have this value, add update DJANGO_SECRET_KEY in .env.
Create Neon Postgres Database
Using the Neon cli via homebrew:
brew install neonctlneonctl authThis will open a browser window to login.
neonctl projects create --name saasOnce created, get the project id:
neonctl projects listProjects
┌──────────────────────────┬────────────────────────────┬───────────────┬──────────────────────┐
│ Id │ Name │ Region Id │ Created At │
├──────────────────────────┼────────────────────────────┼───────────────┼──────────────────────┤
│ steep-base-11409687 │ saas │ aws-us-east-2 │ 2024-06-02T04:03:07Z │
└──────────────────────────┴────────────────────────────┴───────────────┴──────────────────────┘PROJECT_ID=steep-base-11409687Replace steep-base-11409687 with your project id.
Or using the shortcut:
PROJECT_ID=$(neonctl projects list | grep "saas" | awk -F '│' '{print $2}' | xargs)neonctl connection-string --project-id "$PROJECT_ID"Set this value to DATABASE_URL in .env.
source venv/bin/activate
# or .\venv\Scripts\activate if windows
cd src
python manage.py migratepython manage.py createsuperuserpython manage.py vendor_pull- Sign up on Stripe.com for an account
- Get or create a Stripe Secret API Key (Dashboard > Developers > API keys > Secret key )
- Update dotenv (
.env) with the valueSTRIPE_SECRET_KEYwith your key.
python manage.py runserverReady to roll! 🚀
Much more coming soon!