- for
docker
local setup - rundocker compose exec app npm run migrations
- for other database locations - run
npm run migrations
Change database schema and run npm run migrations
- this will create migrations file if needed AND run newly created
migrations on database.
Consider following when creating migration:
- using meaningful name
- separate dropping/creating tables and columns
To populate database with some data(seed it) run npm run seed
.
⚠ Keep in mind that before seeding all data in db will be wiped out.
Thats could be useful if you ran some wrong migration, or messed up things manually.
- for
docker
local setup - rundocker compose exec app npm run migrations:reset
- for other database locations - run
npm run migrations:reset
⚠ Seeding is not automatically running after db reset
Linting is enabled on pre-commit hook, and manually you can run it with npm run lint
or
npm run lint:fix
to automatically apply fixes.
- Checkout and pull latest
dev
branch - Make your new feature branch following naming conventions
- Do your changes, and make pull request in github back to
dev
branch - Ask for review, or(and) assign people on your pr to speed up process
- After receiving enough approves and testing, merge your pull request to
dev
Note: make sure to pull dev frequent, to detect compatibility issues early
- branch name should start with ticket id, separated by underscore with short description in kebab-case
wrong
MID-12_add_cool_feature
wrong
MID-12-add-cool-feature
correct
MID-12_add-cool-feature
- commit should include ticket id in square brackets, following by space and meaningful description what was done
wrong
MID-12 add new linter rules for react
wrong
(MID-12) add new linter rules for react
wrong
MID-12-add-new-linter-rules-for-react
correct
[MID-12] add linter rules for react hooks
We are using Vercel for all the deployments.
All merged pull-requests to the dev
branch automatically deploy to dev-server.
- Install Vercel cli globally with
npm i -g vercel
- Sign in into Vercel ( with github for example )
- Login cli with
vercel login
- Initialize Vercel project with
vercel link
, and accept all defaults - Better will be to set nearest to you region. For it, please, visit
Settings
=>Functions
and setFunction Region
toFrankfurt
or other one. - Create DB on Vercel. Visit tab
Storage
and create postgres DB.
- on the vercel page, go to the db you just created and on the left-side menu click on the "Projects"
- click on the "Connect Project" button to connect the required project
- on the quick start panel at the top, click on the .env.local tab to grab the following env variables:
POSTGRES_URL="************"
POSTGRES_URL_NON_POOLING="************"
- go back to the vercel dashboard and find the project you previously connected to db
- click on "Settings" and then, on the left-side menu, go to the "Environment Variables" to create the following vars:
DATABASE_URL="" <- POSTGRES_URL goes here
DATABASE_DIRECT_URL="" <- POSTGRES_URL_NON_POOLING goes here
- in your local root folder, there has to be a file vercel.json with the following code:
{
"buildCommand": "npm run build",
"devCommand": "npm run dev",
"installCommand": "npm install && npm run migrations && npm run seed"
}
- Open created project in Vercel dashboard, go to settings, and fill required environment variables
- Deploy your app with
vercel deploy
❯ vercel deploy
Vercel CLI 33.3.0
🔍 Inspect: https://vercel.com/alex-popov-tech/mayak/7v5j7Ysq6nuzAFNto7ZxRcGcyWtA [1s]
✅ Preview: https://mayak-gl0htomud-alex-popov-tech.vercel.app [1s]
📝 To deploy to production (mayak.vercel.app), run `vercel --prod`
Preview
is the url of deployed app which already can be shared with others ( but might require login to Vercel ).
You can use dev toolbar at the bottom of the page to make truly public link with share
button.