Discover incredible places and explore Begur like never before.
-
# Install Node.js first npm i -g pnpm
-
Create the file
.env.local
.- Copy the
.env.example
file and update the variables. - Or ask @mauriciabad for the file.
- Copy the
-
Install the project's dependencies:
pnpm i
-
Run development server:
pnpm dev
-
Open http://localhost:3000 with your browser.
Caution
This guide is outdated! The migration to Neon was very fast and I didn't have time to standarize the procedure.
By default, the app will connect to stage database in Neon, but you can run it locally too.
-
Install docker.
-
Run the database in another console:
pnpm db:local:run-db
-
(Optional) Generate migrations if necessary:
pnpm db:generate
-
Run database migrations:
pnpm db:local:migrate
-
Run the app:
pnpm db:local:run-app
-
(Optional) Visualize the data with Drizzle Studio in another console:
pnpm db:local:studio
Caution
This guide is outdated! The migration to Neon was very fast and I didn't have time to standarize the procedure.
- Make the changes in your code, testing them with the local database.
- Run
pnpm db:generate
to generate the migrations. - Run
pnpm db:push
to upload the migrations to PlanetScale stage branch.- Only 1 branch can be pushed to PlanetScale at a time, if there were contents from another change they will be overridden. This is because we use the PlanetScale free tier.
- Run the GitHub's CI after the stage database is updated, by pushing a commit or running it manually.
- GitHub's CI is configured to run on stage database, so it will catch any error.
- Right before merging the PR, go to PlanetScale dashboard and create a deploy preview and deploy it.
- Merge the PR in GitHub.
- Run
pnpm db:generate
, to generate the new sql file. - DON'T run
pnpm db:push
, because it won't work. Instead, go to the Neon website, and in a SQL console paste the generated SQL.
Besides that. These are the manual changes I did to the migration files:
- Add
CREATE EXTENSION IF NOT EXISTS postgis;
to the top - Remove the double quotes (
"
) fromGeometry(Point, 25831)
andGeometry(MultiLineString, 25831)
.
Something else:
The script db:local:run-db
is not done, it is commented out.
Ask @mauriciabad for access.
These are the services we use related to the code: