You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.5 KiB
84 lines
2.5 KiB
# TheTipTop - Fullstack App with Next.js
|
|
|
|
***********************************
|
|
_Explication rapide en français :_
|
|
|
|
Une fois le repo cloné lancer les commandes suivantes :
|
|
|
|
**Lancer docker avec Docker Destop**
|
|
|
|
**docker compose up**
|
|
pour créer les containers avec la base de donnée PosgreSQL et pgAdmin
|
|
|
|
**npm install**
|
|
va installer les dépendances
|
|
|
|
**npx prisma migrate dev**
|
|
va hydrater la db et jouer le fichier de seed
|
|
(important)
|
|
|
|
**npm run db** (pour reset les data de la db)
|
|
va reset la db et re-executer le fichier de seed
|
|
|
|
**npm run dev**
|
|
va lancer l'application sur le _localhost:3000_
|
|
|
|
**npx prisma studio**
|
|
pour naviguer dans la db via le _localhost:5555_ sans utiliser pgAdmin
|
|
|
|
http://localhost:3000/api/superadmin?pass=1234
|
|
pour upgrade votre compte en superadmin (vous devez être connecté)
|
|
|
|
http://localhost:3000/api/gain
|
|
pour générer un gain (vous devez être connecté en tant que superadmin ou admin)
|
|
|
|
**npm run test**
|
|
tests faits avec Playwright
|
|
|
|
***********************************
|
|
|
|
|
|
This project use TypeScript with [Next.js](https://nextjs.org/)** using [React](https://reactjs.org/) (frontend), [Next.js API routes](https://nextjs.org/docs/api-routes/introduction) and [Prisma Client](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client) (backend). It implement authentication using [NextAuth.js](https://next-auth.js.org/). The app uses an PostgreSQL database file on docker's container.
|
|
|
|
Note that the app uses a mix of server-side rendering with `getServerSideProps` (SSR) and static site generation with `getStaticProps` (SSG). When possible, SSG is used to make database queries already at build-time . Sometimes, the user requesting data needs to be authenticated, so SSR is being used to render data dynamically on the server-side.
|
|
|
|
## Getting started
|
|
|
|
|
|
Install npm dependencies:
|
|
|
|
```
|
|
npm install
|
|
```
|
|
|
|
|
|
### 2. Create and seed the database
|
|
|
|
Run the following command to create your PostgreSQL docker's container
|
|
|
|
```
|
|
docker compose up
|
|
```
|
|
|
|
```
|
|
npx prisma migrate dev
|
|
```
|
|
|
|
When `npx prisma migrate dev` is executed against a newly created database, seeding is also triggered. The seed file in [`prisma/seed.ts`](./prisma/seed.ts) will be executed and your database will be populated with the sample data.
|
|
|
|
If you want to reset the database data run the following command
|
|
|
|
```
|
|
npm run db
|
|
```
|
|
|
|
|
|
### 4. Start the app
|
|
|
|
```
|
|
npm run dev
|
|
```
|
|
|
|
The app is now running, navigate to [`http://localhost:3000/`](http://localhost:3000/) in your browser to explore its UI.
|
|
|