Skip to content

A website for my school where the musicians can contact each others, create groups and register to play at events

License

Notifications You must be signed in to change notification settings

Find-A-Musician/findAMusicianBackend

Repository files navigation

Build Status Vulnerabilities commit license Codecov Coverage Issues Pull request

Logo

A website for my school where the musicians can contact each others, create groups and register to play at events
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Development
  4. Useful commands
  5. Contributing
  6. License
  7. Contact
  8. Usefull links

About The Project

The project is still under development, only the backend exists for the moment

Logo

Find A Musician is a web platform that will allow musicians from IMT schools to meet, create bands and participate in events all in a few clicks.

The idea came when I realized that apart from whatsApp conversations or facebook groups, it was super hard to meet musicians or to keep up with different events. Find A Musician is a solution that allows to centralize all these problems on a single web platform making the musical association life much easier.

The platform allows all musicians to :

  • view the profiles of other registered musicians
  • create a band or join an existing one
  • create or join a musical event

Built With

Backend

Frontend

Getting Started

To run the application in development mode, you must run the frontend and the backend separately.

Prerequisites

First of all, make sure you have the following dependencies install on your computer :

Installation

Follow these instructions to run the project in development mode

Backend

  1. Clone the repo

    SSH

    git clone git@github.com:RomainGuarinoni/findAMusician.git

    HTTPS

    git clone https://github.com/RomainGuarinoni/findAMusician.git
  2. Install NPM packages

    npm install
  3. Run the docker container

    docker-compose up

    You need to build the container the first time you run the backend :

    docker-compose up --build
  4. Set up the .env files

    The procedure to receive the .env is not yet implemented, please contact me for the moment

  5. Run the test

    npm run test

Frontend

  1. Place yourself in the frontend folder

    cd frontend
  2. Install the dependencies

    npm install
  3. Run the local developement mode

    npm run dev

Development

You can check the doc to have templates for routes and schemas

Create an OpenAPI definition

Every endPoint has its own API definition based on the OpenAPI sandart.

First, create a file in the folder /api/docs/schemas and create your schema like this :

///api/docs/schemas/example.ts
import { HandlerDefinition } from 'api/types/typing';

const schema: HandlerDefinition = {
  path: '/example', // the path of your endPoint relative to the Base URL of the application
  get: {
    operationId: 'exampleSchema', // a name which represent this operation
    //...a basic OpenAPI schema
  },
};

export default schema;

When the schema is done, it will be auto inserted in the swagger definition and the types corresponding to the schema will be auto generated too.

Create an express route

Create a file in the folder /api/routes and create your route like this :

///api/routes/example.ts
import express, { Request } from 'express';
import core from 'express-serve-static-core';
import type { operations } from '@schema';

//these methods extract the content of an OpenAPI operations type.
import { getHTTPCode, getResponsesBody } from '@typing';

const router = express.Router();

// the key of the operations object is the operationId you gave in the OpenAPI definition
type exampleOperation = operations['exampleSchema'];

const router = express.Router();

router.get(
  '/',
  async (
    req: Request,
    res: core.Response<
      getResponsesBody<exampleOperation>,
      {},
      getHTTPCode<exampleOperation>
    >,
  ) => {
    // ...your code
  },
);

export default router;

Add your route to the server

Finnaly, you need to import your new router in the server/server.ts file like this :

//server/server.ts

import testRouter from '../routes/example';

app.use('/example', testRouter);

Useful commands

Reset the postgres database

api/command/pg_reset.sh

Lint the project

npm run lint

Get a random uuid

npm run uuid

Generate a new password hash

npm run password

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feat/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat(type): subject')
  4. Push to the Branch (git push origin feat/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Romain Guarinoni - linkedin - romain.guar01@gmail.com

Project Link: https://github.com/RomainGuarinoni/findAMusician

Usefull links

Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!

About

A website for my school where the musicians can contact each others, create groups and register to play at events

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages