This is a Next.js project bootstrapped with create-next-app
.
First, install the dependencies
npm install
Then, you will need to setup the database. This app uses a Postgresql database. You can use a local installation. Alternatively, you can also run Postgresql on Docker.
A docker-compose file is already configured in the case you would like to run Postgresql on Docker. In this case, just run the following command:
docker-compose up -d
Setup the .env
inside prisma by copying the example:
cp prisma/.env.example prisma/.env
After making sure Postgresql is running, run the migrations to configure the database
npm run migrate-dev
For now you need to setup Rollout, Pagarme and Hubspot as well as other things (we shall remove some of these dependencies on development environment later, but we haven't yet).
So in order to configure your local development environment you need to setup a .env.local
file, which you can do by copying .env.local.example
and replacing the placeholders with actual value.
Finally, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
Run the following command to run the tests:
npm run test-local
This command will do the following:
- create a new Postgresql database from scratch using docker-compose running on port 5433,
- run the migrations
- run the tests
- destroy the database
Even if the database already exists, it will be reset using the command "npx prisma migrate reset".
Alternatively, if you don't have Docker, you may run the following command:
npm run test
However, note that in this case the tests might fail, since they assume that the database is empty. You will need to setup the database accordingly.