📔 بالعربي 📔
front-end part from here
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.
- On GitHub.com, navigate to the main page of the repository.
- Above the list of files, click Code.
- Copy the URL for the repository.
- Open Terminal.
- Change the current working directory to the location where you want the cloned directory.
- 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.
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.
node -v
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
- You can download NodeJs mac version through the offical website
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
📦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
- 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
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 |