Skip to content

SantiMA10/phone-catalog

Repository files navigation

📞 Phone Catalog Deploy visit it

This is a Next.js project bootstrapped with create-next-app, that uses React to show a Phone Catalog and Next.js API routes as the backend for the catalog.

It also uses...

Getting Started

Configuration

PlanetScale

If you want to setup a PlanetScale instance to use it to develop locally, you need to create a .env.cloud.local (You can use any of the other .env files as a template).

In order to get the DATABASE_URL, you have a few options, all these options are explained here.

Once you have the DATABASE_URL, you have to run yarn cloud:migrate to create the needed tables on PlanetScale.

Then you can use the yarn cloud:dev command to start the dev server connected to PlanetScale.

Development

First, run the development server:

yarn install

yarn docker:dev // to use a local MySQL instance manage with Docker
yarn cloud:dev // to use a remote MySQL instance manage with PlanetScale
yarn dev // alias for yarn docker:dev

Open http://localhost:3000 with your browser to see the result.

Testing

yarn install

yarn test // runs all the tests using jest
yarn test:unit // runs all the unit tests using jest
yarn test:integration // runs all the integration tests using jest  ⚠️ it requires a MySQL instance ⚠️
yarn test:watch // runs jest in watch mode

docker:test:integration // setup MySQL using docker and runs all the integration tests
docker:test:watch // setup MySQL using docker and the tests in watch mode

Deploy

This is project is deployed to Vercel automatically using GitHub Actions on each push to main and uses as database PlanetScale, since it is a MySQL-compatible serverless database.