The backend for Dinder π«
Screenshots β’ How It's Made β’ Usage β’ Optimizations β’ Summary β’ Author
π Live project: Dinder Is Served
Designed and built from scratch using the Node.js runtime & Express.js for handling routes and creating Dinder's API endpoints. Users are able to create accounts and log in, update profile information and create location-based feasts containing restaurants tailored to their occasion. Real-time establishment data is sourced from Google Maps and are stored alongside user votes in a PostgreSQL database. I also created authentication middleware to protect the API using JWTs, and authorization middleware to prevent voter fraud. The web service and hosted DB are both deployed on Render.
-
Clone the repository
git clone https://github.com/thinktapper/DinderIsServed.git
-
Install the necessary packages
Go to the main directory and install the necessary packages
cd DinderIsServed/ npm i
-
Add credentials
A
.env
file will need to be added to the project root with the following variables:DATABASE_URL="postgresql://<username>:<password>@localhost:5432/<database>?schema=public" SECRET="<your-jwt-secret>" GOOGLE_API="<your-google-maps-api-key>"
-
Create the database
npx prisma migrate dev --name init
-
Run the server
npm run dev
The server will be running on
localhost:3000
With time, I plan to add the following features:
- Implement rate limiting to prevent brute force attacks
- Resolve security vulnerabilities in dependencies
- Add feature for users to create groups of friends/family members called Herds
- Create sharable links for inviting other users (registered or not) to join Herds
- Add a feature so users can add restaurants to their favorites
- Add a feature so users can filter restaurants by various criteria
- Add options for that criteria in the feast creation form & persist in the database
- Add more detailed documentation for the API endpoints.
See the open issues for a full list of proposed features (and known issues).
This project was a great way to learn more about the backend and how to create a Node + Express REST API server in TypeScript. I learned a lot about authentication & authorization by rolling my own auth middleware, and about how to deploy a secure API.
- Strengthened skills needed to plan, scope, research, and deploy an API.
- Learned how to use JWTs to authenticate users and protect routes.
- Practiced creating middleware to protect voting integrity amongst users.
- Practiced using Prisma to generate relational database models and interact with the DB.
- Learned how to create a seed script to populate the database with mock data.
- Learned how to use the Google Maps API to fetch real-time restaurant data.
- Learned how to set up continuous deployment with CI.
- Gained experience debugging and troubleshooting TypeScript and ESLint build errors and deployment issues.
Andrew Tapper - @thinktapper - [email protected]
Frontend | Client app: https://github.com/thinktapper/DinderRN
Parent Project: https://github.com/thinktapper/dinder
Distributed under the GNU GPLv3. See LICENSE
for more information.