|
|
4 years ago | |
|---|---|---|
| .vscode | 4 years ago | |
| components | 4 years ago | |
| context | 4 years ago | |
| enum | 4 years ago | |
| lib | 4 years ago | |
| middleware | 4 years ago | |
| pages | 4 years ago | |
| prisma | 4 years ago | |
| public | 4 years ago | |
| styles | 4 years ago | |
| tests | 4 years ago | |
| types | 4 years ago | |
| .env | 4 years ago | |
| .gitignore | 4 years ago | |
| README.md | 4 years ago | |
| docker-compose.yaml | 4 years ago | |
| next-env.d.ts | 4 years ago | |
| next.config.mjs | 4 years ago | |
| package-lock.json | 4 years ago | |
| package.json | 4 years ago | |
| tsconfig.json | 4 years ago | |
README.md
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** using React (frontend), Next.js API routes and Prisma Client (backend). It implement authentication using NextAuth.js. 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 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/ in your browser to explore its UI.