- Unzip the folder
- Rename the unzipped folder from
bedrock-x.y.zto your product’s name
- Open the directory on your terminal and initialize git:
cd git init
After that, you’re ready to get started!
You’ll need certain environment variables to run Bedrock’s functionality in local development. The first step is to:
.env and fill out the
.env file with your environment variables!
cp .env.example .env
Note: do not delete the
.env.examplefile, as it’s used by some code generation processes and is useful for potential future team members as a reference.
Now you’re ready to set everything up locally:
- Install Docker by following their installation instructions for your OS. Bedrock uses Docker to start the local development database.
- Then, install the dependencies with
Start the local development database as well as the Stripe CLI webhook listener (to make payments work) with
Copy the webhook secret that the Stripe CLI logged, something like “> Ready! Your webhook signing secret is whsec_***”. Copy that secret and add it to your
- Migrate your local development database to the base schema:
To develop your app, you always need to have two commands running concurrently:
- Start the development database with:
- Start the development process , which also runs all the necessary code generators:
That’s it! Now you should have Bedrock running locally and should be able to visit http://localhost:3000
The three most important commands you’ll run frequently during development:
yarn generate: Generates the Prisma client (docs), which Nexus uses and generates the GraphQL schema (docs), which GraphQL Codegen uses and generates the urql hooks (docs). Run this whenever you change the database schema, GraphQL schema or GraphQL queries.
yarn prisma:migrate: Creates migration files from your Prisma schema changes and runs those migrations on your local dev db (docs). Run this whenever you change your database schema.
yarn prisma:studio: Starts Prisma Studio on
localhost:5555where you can inspect your local development database.
yarn cypress:open: Opens Cypress so you can write and run your end-to-end tests. (docs)
All the others are used in CI or by those three main scripts, but you should only rarely need to run them manually.