Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
petrpavlik committed Jan 21, 2024
1 parent 3787a5c commit b74dadb
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# SAAS Backend Starter Template

**You can check out my project [IndiePitcher](https://indiepitcher.com) for an example of a SAAS with a backend written in Swift, using this template.**

This is an extension of Vapor's [starter template](https://github.com/vapor/template) to get the backend for your next SAAS off the ground. Or if you're jsut curious about server-side Swift and Vapor, and would like to see some real code.

It takes care of the tedious tasks for you, **user management, sending emails, analytics, error logging**...

Every SAAS needs to handle user sign up, and if your service takes off, you'll start being asked by customers how they can invite their colleagues. This ends up being a huge pain if everything is tied to a user profile instead of an organization unit. That's why this template includes a complete organization management with 3 levels of user permission. You can create a default org with a user profile during sign up that's hidden from the user, that's fine, and you are ready for to future.

- This repo will be expanded and kept up to date with the latest Swift and Vapor releases, feel free to subscribe for updates and check out the [roadmap](https://github.com/users/petrpavlik/projects/3/views/1)
- **I'm working on a course explaining everything in in a very detailed way. Scroll down to learn more.**
- This repo will be expanded and kept up to date with the latest Swift and Vapor releases, feel free to give it a star and/or subscribe for updates.
- **I'm working on a course explaining everything in in a very detailed way. Scroll down to learn more and [join the waitlist](https://tally.so/r/wbdgqg).**

## Overview
- **JWT-based user authentication using Firebase**
Expand All @@ -18,7 +21,7 @@ Every SAAS needs to handle user sign up, and if your service takes off, you'll s
- Swappable for a different database supported by Vapor’s ORM framework Fluent, I’d recommend sticking with PostgreSQL though
- **Sending emails using SMTP**
- Send automated emails such as "You've been added to RockerAI organization as an admin."
- Can be swapped for Sendgrid or other solution
- Can be swapped for Sendgrid or another solution
- **Tracking of server events to Mixpanel**
- Tracking important events, such as new user sign up, is more reliable to track from the backend than
- Mixpanel offers a generous free tier and is realtime.
Expand All @@ -34,21 +37,14 @@ Every SAAS needs to handle user sign up, and if your service takes off, you'll s

## How to Use
- Clone this repo to use it as a building block for your project
- When cloned, create `.env` file and fill in following info to be able to run the app against local database.
- You'll need a postgre database. You can
- When cloned, create `.env` file and fill in following info to be able to run the app against a local database.
- ```
FIREBASE_PROJECT_ID=your-firebase-project-id
```
- This is enough to run the project locally. When deploying to production, you'll want to add the database connection keys, as well as optionally your mixpanel and sentry credentials
- To be able to run the unit tests, create `.env.testing` file and fill in following info
- ```
TEST_FIREBASE_WEB_API_KEY=your-firebase-project-web-api-key
TEST_FIREBASE_USER_EMAIL=...
TEST_FIREBASE_USER_PASSWORD=...
TEST_FIREBASE_USER_2_EMAIL=...
TEST_FIREBASE_USER_2_PASSWORD=...
```
- The tests will use 2 firebase user accounts to run the tests
- Set up your local dev environment by downloading Docker and typing in following commands
- You can copy the `FIREBASE_PROJECT_ID` from `.env.testing` to try things out, but please do create your own firebase project.
- Set up your local dev environment, you need to spin up a database. An easy way is by downloading [Docker](https://www.docker.com) and typing in following commands
- `docker-compose build`
- `docker-compose up db` starts a local database to develop against
- `docker-compose up db-test` starts a local database to run init tests against (this is a separate database so you don't wipe your data when running unit tests)
Expand All @@ -64,7 +60,7 @@ You can also check out fly.io since they offer a free tier, or good old Heroku u


## Want to Learn More?
I'm hard at work working on a video course providing a detailed walk through of this template and Vapor framework in general. If you're interested, or would just like to support further development, you can [pre-order the course at a 50% discount](https://buy.stripe.com/4gwbLy5X02MqaModQQ). You'll get all the materials to the amail you provide during the checkout as soon as I start rolling the course out.
I'm hard at work working on a video course providing a detailed walk through of this template and Vapor framework in general. If you're interested, or would just like to support further development, you can [join the waitlist](https://tally.so/r/wbdgqg).

I'd also encourage you to join the [vapor discord](https://discord.gg/vapor). Feel free to DM me there.

0 comments on commit b74dadb

Please sign in to comment.