Start building your boring database in 5 mins
Clone the boring database repo
npm i
to install all dependeciesbrew install sqlite
and create a new database with sqlite3 sqlite.db
.
When you deploy your app, the dockerfile with let Fly will create it’s own sqlite.db file.
Set environment variables
test
environment vairables for your stripe account until you are ready to go live!
To see how the seed file works/make any changes navigate to the prisma/seed.ts
npx prisma migrate dev --name init
- will run the initial migration
npx prisma migrate reset
- this will force the seed.ts file to run and load your database with data.
You should see success messages logged to the console.
To check the seed has worked you can run npx prisma studio
in a new terminal window to start a database UI and explore the tables and records created.
npm run dev
in the terminal to start your app.
You can click one of the purchase buttons to test stripe checkout is correctly linked up.
Or try login with admin@admin.com
at Login no One time passcode is sent via email for admin user, you can grab the passcode from the terminal of the running app.
prisma/seed.ts
should keep prices in sync for you.
If you ever need to reset your database for a clean start locally you can run npx prisma migrate reset --force
.
This will remove all the data from the sqlite database and force the seed.ts file to run again.
The seed.ts file will fetch products from stripe and populate your plans and products.
fly launch
. You can
follow the prompts to create a new fly app.
If you have not logged into fly through the CLI before you will be prompted to login.
In the Fly CLI you’ll see your app being built from the dockerfile. Once it has been deployed you can run fly apps open
in the terminal to open up a browser window with your new app.
fly deploy
to rebuild and push your new changes to production.
We can do better than that though! In our next step we will cover setting up a Github Action for running tests and deploying our app to fly automatically.