A RESTful API built with Node.js and Express, featuring full CRUD operations and live deployment.
This project evolved from a simple file-based API into a cloud-connected backend system using MongoDB Atlas, demonstrating real-world debugging, deployment, and security practices.
Author: Roland
You can access the deployed API here:
https://express-user-api-2aws.onrender.com
Base URL:
https://express-user-api-2aws.onrender.com
Example endpoint:
https://express-user-api-2aws.onrender.com/users
API test route:
https://express-user-api-2aws.onrender.com/api?name=Roland
Note:
The live version may reset data due to free hosting limitations.
This project started as a lightweight REST API using file-based storage (users.json) and was later upgraded to use MongoDB Atlas with Mongoose.
It now supports full CRUD operations with a cloud-hosted database.
The project demonstrates:
- Express server setup
- RESTful route design
- Query and route parameters
- JSON request handling
- Input validation
- Duplicate-name checking
- Transition from file storage to MongoDB
- API testing with Thunder Client
- Create new users →
POST /users - Retrieve all users →
GET /users - Retrieve a user by ID →
GET /users/:id - Update user information →
PUT /users/:id - Delete users →
DELETE /users/:id - Input validation prevents empty or missing names
- Duplicate user prevention is case-insensitive
- Cloud-based data storage using MongoDB Atlas
- Backend: Node.js, Express.js
- Database: MongoDB Atlas, Mongoose
- Testing: Thunder Client
- Deployment: Render
- Tools: VS Code, PowerShell
- Node.js → https://nodejs.org/
- Express.js → https://expressjs.com/
- JSON → https://www.json.org/json-en.html
- Visual Studio Code → https://code.visualstudio.com/
- Windows 11 → https://www.microsoft.com/windows/windows-11
- PowerShell → https://learn.microsoft.com/powershell/
- Thunder Client → https://www.thunderclient.com/
- Render → https://render.com/
flowchart TD
A[Client] --> B[Express Server]
B --> C[API Routes]
C --> D[Mongoose Model]
D --> E[MongoDB Atlas]
E --> D
D --> C
C --> F[JSON Response]
F --> A
- Data stored in
users.json - Simple file read/write operations
- No database dependency
- Migrated to MongoDB Atlas
- Uses Mongoose for data modeling
- Cloud-based persistent storage
- Improved scalability and structure
https://express-user-api-2aws.onrender.com
GET / Example: http://localhost:3000/
GET /about Example: http://localhost:3000/about
GET /users Example: http://localhost:3000/users
GET /users/:id Example: http://localhost:3000/users/1
POST /users
Example request body:
{ "name": "Test" }
Example Response
{
"_id": "661234abcd1234",
"name": "Test",
"createdAt": "...",
"updatedAt": "..."
}npm install
node server.js
- Clone the repository:
git clone https://github.com/rpratts1/express-user-api.git
- Navigate to the project folder:
cd express-user-api
- Install dependencies:
npm install
- Start the server:
node server.js
- Open in browser:
Main application file containing:
- Express setup
- Routes
- Validation
- File reading and writing
- CRUD operations
Previously used for file-based storage in Version 1.
Stores project metadata and dependencies.
Prevents unnecessary files like node_modules from being uploaded.
https://github.com/rpratts1/express-user-api
These improvements are planned to make the project more production-ready and scalable.
- Expand MongoDB schema for more complex data
- Add JWT authentication for secure login and protected routes
- Use
.envfor configuration management - Add centralized error handling middleware
- Improve validation using Joi or Express Validator
- Implement password hashing with bcrypt
- Add rate limiting
- Use Helmet for secure HTTP headers
- Configure CORS properly
- Add database indexing
- Implement caching
- Prepare app for Docker deployment
- Add logging (Morgan/Winston)
- Write unit and integration tests (Jest/Mocha)
- Document API with Swagger
- Build React frontend
- Create user dashboard
- Convert to full-stack application
- Set up CI/CD pipelines
- Add monitoring and uptime tracking
- Deploy to AWS or Azure
Sensitive data such as database credentials are stored in environment variables using .env and are not committed to GitHub.
Previously exposed credentials were rotated and removed to follow best security practices.
- REST API design
- CRUD operations
- MongoDB Atlas integration
- Environment variable management (.env)
- Debugging network and authentication issues
- API testing (Thunder Client)
- Cloud deployment (Render)
- Git & GitHub version control
- Built a REST API using Node.js and Express
- Implemented CRUD operations
- Handled JSON file-based storage
- Performed API testing using Thunder Client
- Deployed a live API using Render
- Managed version control using Git and GitHub
This project demonstrates:
- Backend API development
- RESTful design principles
- Data validation and error handling
- Real-world deployment workflow
- Version control using Git and GitHub
This project was more than just building an API—it was a hands-on learning experience in real-world backend development using Node.js, Express, and MongoDB Atlas.
I created a RESTful API that supports full CRUD operations:
- Create users (POST)
- Read all users (GET)
- Read a single user by ID (GET)
- Update users (PUT)
- Delete users (DELETE)
The API is connected to a cloud-hosted MongoDB database using Mongoose.
During development, I encountered several real-world issues:
- MongoDB connection errors (
ECONNREFUSED) - Authentication failures (
bad auth) - Incorrect connection string formats
- Environment variable misconfiguration (
.env) - Accidentally exposing credentials to GitHub
- IP access configuration in MongoDB Atlas
- Fixed connection string using proper MongoDB URI format
- Updated database user credentials and rotated passwords
- Configured IP access in MongoDB Atlas (
0.0.0.0/0for testing) - Used
dotenvto securely manage environment variables - Removed
.envfrom GitHub and added it to.gitignore - Verified DNS resolution using
nslookup - Tested endpoints using Thunder Client in VS Code
This project helped me understand:
- How backend APIs actually connect to cloud databases
- The importance of environment variables and security
- How to debug real connection and authentication issues
- How to test APIs using tools like Thunder Client
- How to structure a Node.js + Express + MongoDB application
Building this project showed me that backend development is not just about writing code—it’s about troubleshooting, debugging, and understanding how different systems work together.
I plan to continue improving this project by adding:
- User authentication (JWT)
- Password hashing (bcrypt)
- Input validation
- Error handling improvements
- Protected routes


