Skip to content

Latest commit

 

History

71 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-manager-and-test

An api manager using Fastify, Vite, MariaDB on Docker. We will manage some books in this project.

Project Structure

  • /docker-mariadb
    • ./docker-compose.yaml => our database inside a container and inside a compose
    • ./db-data => generated by docker where we store data for db (it is a volume)
    • ./.env => generated by you (See the third step)
  • /fastify-backend
    • ./prisma => it is for storing migrations, schema settings, and seeding options
    • ./src/models => we define here our routes, services, handlers ...
    • ./src/utils => it is for utilities
  • /frontend => it is for handling Books (admin site) (Update, Delete, Create)
  • /react-frontend => it is for the clients, it is the real frontend
    • ./src => it is holding the react components, assets, constants and hooks

Prerequisite for the project

  • Docker
  • Node.js
  • GIT
  • Database manager (like DBeaver)

How to start and initiate it1

  1. git clone 'the repository URL'
    git clone https://github.com/20HDMI04/api-manager-and-test.git
  1. npm install in each folder to get the dependecies
    npm install
  1. adding the .env folder to /fastify-backend and /docker-mariadb the /fastify-backend/.env structure
    DATABASE_URL="db_service://*hostname*:*password*@*ip*:*socket*/*your db name*"
    DBNAME=**your db name**
    DBPASSWORD=**your db password**

the /docker-mariadb/.env structure

    DBNAME=**your db name**
    DBPASSWORD=**your db password**
  1. RUN the db with docker
**in the /docker-mariadb directory**
    docker compose up
  1. prisma migration
    npx prisma migrate dev --name **your migration name**
  1. prisma db seed
    npx prisma db seed

to reset the db you can run:

    npx run reset

OR

    prisma db push --force-reset
  1. RUN the backend and the frontend
**in the /fastify-backend and the /frontend directory**
    npm run dev

API documentation

made by Swagger you can find it here: http://localhost:3000/documentation

you can't watch it without the backend

Contributors

Footnotes

  1. not tested so it might not work (it is for the sake of understanding the backend)

About

An api manager

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages