Project Overview
Public Safety is a full-stack project that provides community members with information about public safety initiatives and an easy way to apply as volunteers. The app uses a React frontend and an Express/MongoDB backend to securely collect and store volunteer applications.
Goal
Build a responsive landing page that communicates public safety initiatives and allows users to submit volunteer applications.
Process
Throughout the development process, I encountered a few challenges:
-
Challenge: This was my first time using
MongoDBandMongoose. Understandingschemas, connecting the database, handlingasyncoperations, and managing environment variables was initially confusing, especially when moving from local development to deployment.
Solution: I reviewedMongoosedocumentation, learned how to structure a schema, and followed best practices forasyncerror handling. I also learned how to keep sensitive credentials safe using environment variables instead of hardcoding them. Deployment required whitelisting server IPs inMongoDBAtlas and setting up the correct connection string for production. -
Challenge: During development, I originally used
port 5000for my backend, not realizing that macOS uses that port for system services. This caused random connection failures(403 status), and the server wouldn’t start.
Solution: I changed the development port to 3000, which solved the conflict and helped me understand that certain ports are reserved or have higher chances of conflict on different operating systems. -
Challenge: Hosting both the frontend and backend was still a bit new to me since this was my second full-stack project. Hence, I ran into some issues with missing
Nodemodules, incorrect build commands, and environment variables not being detected on Render. The backend would build successfully but fail at runtime because modules weren’t installed and the database wasn't connecting.
Solution: I learned how hosting platforms work behind the scenes, specifically how they install dependencies and run build/start commands. Addingnpm installto the Render build step and correctly setting my environment variables fixed the issues. I also switched to using a shared access inMongoDBso that any IP address could connect without being whitelisted. -
Challenge: Coming from basic
JavaScript, thinking in terms of components, props, and reusable UI patterns was a bit new to me. I also had to learn how to handle form state and success/error messages.
Solution: I broke the UI into small reusableReactcomponents(forms, cards, sections)and useduseStateto manage input and submission states. This helped me understand component architecture and code organization. -
Challenge: I started using Flowbite but later decided to remove it to have more control over the design.
Solution: I rebuiltbuttons,cards,inputs, andlayoutsusing pureTailwind CSS. This helped me gain confidence in styling and improved the quality and consistency of the final UI.
Tech Stack
Node.js
Express
MongoDB
React
TailwindCSS
Key Features
- A search feature to find volunteer programs
- Registration form that submits users application data to MongoDB
- A contact form for users to reach out
What I Learned
This project taught me valuable lessons, including:
- How to structure and organize a React project
- Building a REST API to POST data
- Connecting Node/Express apps to MongoDB Atlas
- Debugging and troubleshooting issues in full-stack applications