This project is the repository of the EPITA SCIA Major of EPITA. The tech stack is pretty simple :
- Next.js for frontend (React + TS) and backend (TS).
- PostgreSQL.
- Prisma as the ORM, used in the backend.
- Liquibase as DB migration tool.
- Docker for containers.
- Node version: 22.9.0.
- npm version: 10.9.0.
- Docker and Docker Compose.
- Make (for command aliases).
We also recommend to install these tools for easier development :
- A DB tool such as DBeaver.
- An API platform such as Insomnia or Postman.
- VSCode extensions: Prettier, ESLint, Prettier ESLint, Prettier SQL VSCode.
Also, have a look at docs of the tech stack.
-
Clone the repository:
foo@bar:~$ git clone git@github.com:TopAgrume/SCIA_website.git foo@bar:~$ cd SCIA_website
-
Install the dependencies:
foo@bar:~$ npm install -
Set up environment variables: Create a
.envfile by doing the following command:foo@bar:~$ cp .env.example .env -
Start the Development Environment:
foo@bar:~$ npx prisma generate # generate a prisma client synced with /prisma/schema.prisma to use the prisma API in the backend. foo@bar:~$ make dbup foo@bar:~$ npm run dev # front on localhost:3000
You can also use
make allupif you want to dockerized the Next.js app (don't donpm run devin that case). Consider usingmake dbupfor hot reload when working on front or backend.npx prisma generatehas to be done each time there is changes in schema.prisma.
- TODO
Database migrations are handled by Liquibase, here is how to use it:
- To add changes to the DB, add a file in /db/changelogs/developpers, starting with the date and what the file is about.
- To add this file to the DB version, either add a line to the last changelog file in /db/changelogs/versions, or create a new changelog file (if so, change the DB_VERSION in your
.envfile, you can also set it in the.env.example). Have a look atchangelog_init.xmlto understand how to add new files and link changelogs. - Don't modify existing
.sqlfiles in /developpers, add a new one to update old code. - When starting the db docker container with new changes, don't forget to run
npx prisma db pullafter the db-migrator ended to update theschema.prismafile, and also runnpx prisma generate.
- Try using meaningfull commit messages.
- Commit format :
[{branch}] {feat/fix/tests}: {commit_message} - It's cool to have PR.
- Consider using rebase for sexy history (
mergeis also good).foo@bar:~$ git branch > my_branch foo@bar:~$ git fetch origin main # if you want to merge on main foo@bar:~$ git rebase main foo@bar:~$ git checkout main foo@bar:~$ git merge my_branch
foo@bar:~$ npm run lint # Run ESLint check
foo@bar:~$ npm run format # Run ESLint and Prettier fix- If you use LLMs, always check and understand the code they produce (which is very error prone).
- Don't trust the user, meaning all frontend validations also need to be done in backend.
- Keep your code clean and concise so that it is understandable.
- Use Vim.
- Handle every error case, and don't show the raw error to the user.
- There is a lot of features in the tools we are using, consider reading the docs and update parts of this README.
- Don't Hesitate to add yours!
Contact djdonpablo on Discord.