Giter Site home page Giter Site logo

wfyb-backend's Introduction

WFYB

📔 بالعربي 📔

front-end part from here

🚩 Table of Contents

Introduction

We fund your project (WFYB) is a platform where any starter ( ideas owner) who’s looking for investors to his/her project can use this platform , create his project , then the backer (investor) will back his/her project.

This project consist of two parts , front-end , and backend which you are reading right now .

This restful API has in total 6 different routes , each route has some paths , let’s take a general look about these routes.

  • User : We have five different paths , two pasts for signIn and signUp paths, one get path for verify , and one get path for resend verify email , and last one is put path for update user attributes.

  • Starter: We only has one path which his put , which only update or modify shortIntro for starter , you can add more attributes for your starter model.

  • Project : Under this route we have six paths , main three post , put and delete paths , and three different get paths , all to get all project exist in DB , starter to get one starter all projects , search to get result of searching existing projects by it’s title.

  • Pledge: We only have one post path , where backer(investor) can create a pledge to one specific project.

  • Comment : Under this route we have three main paths , post , put and delete , here I need to mention that comments only available for backer who already invested in the target project .

  • Reply: This route is very similar to comment route , has three main paths post , put and delete , but in this route only the stater (project owner) can reply on backer’s comments.

Installation

🔘 Cloning repository

  1. On GitHub.com, navigate to the main page of the repository.
  2. Above the list of files, click Code.
  3. Copy the URL for the repository.
  4. Open Terminal.
  5. Change the current working directory to the location where you want the cloned directory.
  6. Type git clone, and then paste the URL you copied earlier.
git clone github.com/Faris-abukhader/WFYB-backend

Press Enter to create your local clone

git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `WFYB-backend`...
> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.

Development setup

To set up this project you need to download NodeJs in your machine or if you have it make sure you have the latest version of it.

🔘 Checking up Node version

node -v

🔘 Downloading Node

for Windows

Download the windows installer from NodeJs offical website make sure you have download the latest version of NodeJs.

for Mac

  • You can download NodeJs using brew CLI
brew install node


🔘 Downloading the packages

Go to project direct where <package.json> is exist and type in terminal :

npm install 

Now you need to create DB server connection , after you create it , create .env file and type :

# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

DATABASE_URL="mysql://<USERNAME>:<YOUR_PASSWORD>@localhost:3306/<DB_NAME>?schema=public"

Now you need to step up Prisma ORM , type in your terminal :

cd prisma 
prisma migrate dev

To run the project just type down in terminal :

npm run dev


Project structure

📦WFYB-backend 
 ┣ 📂auth
 ┃ ┣ 📜authController.js
 ┃ ┣ 📜authRoute.js
 ┃ ┗ 📜authSchema.js
 ┣ 📂comment
 ┃ ┣ 📜commentController.js
 ┃ ┣ 📜commentRoute.js
 ┃ ┗ 📜commentSchema.js 
 ┣ 📂pledge
 ┃ ┣ 📜pledgeController.js
 ┃ ┣ 📜pledgeRoute.js
 ┃ ┗ 📜pledgeSchema.js
 ┣ 📂preValidation
 ┃ ┣ 📜backerMiddleware.js
 ┃ ┣ 📜starterMiddleware.js
 ┃ ┣ 📜userMiddleware.js
 ┃ ┗ 📜websiteMiddleware.js
 ┣ 📂prisma
 ┃ ┗ 📜schema.prisma
 ┣ 📂project
 ┃ ┣ 📜projectController.js
 ┃ ┣ 📜projectRoute.js
 ┃ ┗ 📜projectSchema.js
 ┣ 📂reply
 ┃ ┣ 📜replyController.js
 ┃ ┣ 📜replyRoute.js
 ┃ ┗ 📜replySchema.js
 ┣ 📂starter
 ┃ ┣ 📜starterController.js
 ┃ ┣ 📜starterRoute.js
 ┃ ┗ 📜starterSchema.js
 ┣ 📂util
 ┃ ┣ 📂emailConfig
 ┃ ┃ ┣ 📂templates
 ┃ ┃ ┃ ┣ 📜resetPassword.html
 ┃ ┃ ┃ ┗ 📜verify.html
 ┃ ┃ ┣ 📜emailConfig.js
 ┃ ┃ ┣ 📜script.js
 ┃ ┃ ┗ 📜sendInBlue.js
 ┃ ┣ 📜docGeneratorOptions.js
 ┃ ┣ 📜paginationRange.js
 ┃ ┗ 📜schemaContainer.js
 ┣ 📜.env
 ┣ 📜.gitignore
 ┣ 📜app.js
 ┣ 📜package-lock.json
 ┗ 📜package.json

Features

  • Simple rest API doc , generated using swagger library , you can check that out at :
http://localhost:4500/doc
  • Authentications , authorizations are all implemented with differents layers , check Prevalidation folder .
  • Credentials is all well encoded before it saves to DB.
  • Custom implementation of verify account by email

📦 Packages

Name Description
@fastify/cors Fastify CORS
@fastify/static Plugin for serving static files as fast as possible
@fastify/swagger Swagger-compliant APIs entirely in Node.js
@prisma/client Next-generation ORM for Node.js & TypeScript
prisma Next-generation ORM for Node.js & TypeScript
bcrypt A library to help you hash passwords
fastify Fast and low overhead web framework, for Node.js
handlebars A Handlebars view engine for Express which doesn't suck
jsonwebtoken JSON Web Token implementation (symmetric and asymmetric)
nodemailer Easy as cake e-mail sending from your Node.js applications
nodemon Simple monitor script for use during development of a Node.js app
sib-api-v3-sdk SendinBlue's API v3 Node.js Library

📜 License

This software is licensed under the MIT © FaRiS.

wfyb-backend's People

Contributors

faris-abukhader avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.