[go: up one dir, main page]

Skip to content

mauriciabad/begursecret

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Begur Secret App

Discover incredible places and explore Begur like never before.

https://begursecret.com

Development

Setup

  1. Install Node.js and pnpm

    # Install Node.js first
    npm i -g pnpm
  2. Create the file .env.local.

    • Copy the .env.example file and update the variables.
    • Or ask @mauriciabad for the file.
  3. Install the project's dependencies:

    pnpm i
  4. Run development server:

    pnpm dev
  5. Open http://localhost:3000 with your browser.

Using local database

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.

  1. Install docker.

  2. Run the database in another console:

    pnpm db:local:run-db
  3. (Optional) Generate migrations if necessary:

    pnpm db:generate
  4. Run database migrations:

    pnpm db:local:migrate
  5. Run the app:

    pnpm db:local:run-app
  6. (Optional) Visualize the data with Drizzle Studio in another console:

    pnpm db:local:studio

Contributing

How to deploy changes in the database

Caution

This guide is outdated! The migration to Neon was very fast and I didn't have time to standarize the procedure.

  1. Make the changes in your code, testing them with the local database.
  2. Run pnpm db:generate to generate the migrations.
  3. 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.
  4. 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.
  5. Right before merging the PR, go to PlanetScale dashboard and create a deploy preview and deploy it.
  6. Merge the PR in GitHub.
New procedure random thoughts
  1. Run pnpm db:generate, to generate the new sql file.
  2. 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:

  1. Add CREATE EXTENSION IF NOT EXISTS postgis; to the top
  2. Remove the double quotes (") from Geometry(Point, 25831) and Geometry(MultiLineString, 25831).

Something else:

The script db:local:run-db is not done, it is commented out.

Access to other services

Ask @mauriciabad for access.

These are the services we use related to the code: