Yes, Express and MongoDB are a sound choice for a first internship project at DDU Gorakhpur University. A small CRUD app (create, read, update, delete) covers routing, data modelling, validation and error handling in one project, and it fits a 14-day internship. Keep the scope to one resource, finish it fully, and document it well.
Why a single-resource CRUD app suits a 14-day internship
Two weeks is short. Beginners usually fail by choosing a project that is too big: login, payments, file uploads and a dashboard, none of them finished. A one-resource API with a simple front end shows more skill than five half-built features.
Express and MongoDB suit this because both use JavaScript and JSON throughout. You do not switch mental models between the server, the database and the browser. You also touch the parts interviewers ask about: HTTP verbs, status codes, schemas, middleware and environment variables.
The free two-week online internship from CareerSwami has 26 tracks, including full stack development. It gives you a free offer letter and, after successful completion, a free completion certificate. The project below is sized for a track like that, but it works as a self-paced practice plan too.
What you need installed before Day 1
- Node.js (LTS version) and npm. Run
node -vandnpm -vto confirm. - MongoDB, either a local Community Server or a free MongoDB Atlas cluster. Atlas avoids local setup problems, but you must allow your IP address in its network settings.
- A code editor such as VS Code, plus a REST client (Postman, Thunder Client or curl).
- Git and a GitHub account, so your work has a visible commit history.
Free 2-Week CareerSwami Internship
Online, 14 days, with a free offer letter and a free completion certificate once you finish the work. Check with your college that it fits your requirement before you enrol.
Folder structure template for an Express and MongoDB project
Separating routes, controllers and models from the first day keeps files short and makes bugs easier to find. Copy this layout for the walk-through below. The resource is a “task” in a simple task tracker, but you can rename it to books, notes or expenses.
task-tracker-api/
├── .env # secrets, never committed
├── .env.example # variable names only, committed
├── .gitignore # node_modules, .env
├── package.json
├── server.js # starts the app and the DB connection
├── README.md # setup steps, endpoints, screenshots
└── src/
├── app.js # express app, middleware, route mounting
├── config/
│ └── db.js # mongoose connection
├── models/
│ └── Task.js # schema and model
├── controllers/
│ └── taskController.js
├── routes/
│ └── taskRoutes.js
└── middleware/
└── errorHandler.js
Splitting app.js from server.js is optional, but it lets you import the app for testing later without opening a port.
Walk-through: building the CRUD API step by step
The code below is illustrative and meant to be typed and tested by you. Run each endpoint yourself in a REST client before moving on.
Step 1: Initialise the project and install packages
mkdir task-tracker-api && cd task-tracker-api
npm init -y
npm install express mongoose dotenv
npm install --save-dev nodemon
Add "start": "node server.js" and "dev": "nodemon server.js" under scripts in package.json. Create a .env file with PORT=5000 and MONGO_URI= followed by your connection string.
Step 2: Connect to MongoDB
// src/config/db.js
const mongoose = require('mongoose');
async function connectDB() {
await mongoose.connect(process.env.MONGO_URI);
console.log('MongoDB connected');
}
module.exports = connectDB;
// server.js
require('dotenv').config();
const app = require('./src/app');
const connectDB = require('./src/config/db');
const PORT = process.env.PORT || 5000;
connectDB()
.then(() => app.listen(PORT, () => console.log('Server on ' + PORT)))
.catch((err) => {
console.error('DB connection failed:', err.message);
process.exit(1);
});
Starting the server only after the database connects prevents requests from hitting a dead connection.
Step 3: Define the model with validation
// src/models/Task.js
const mongoose = require('mongoose');
const taskSchema = new mongoose.Schema(
{
title: { type: String, required: true, trim: true, maxlength: 120 },
done: { type: Boolean, default: false }
},
{ timestamps: true }
);
module.exports = mongoose.model('Task', taskSchema);
Step 4: Write the controller
// src/controllers/taskController.js
const mongoose = require('mongoose');
const Task = require('../models/Task');
exports.createTask = async (req, res, next) => {
try {
const task = await Task.create({ title: req.body.title });
res.status(201).json(task);
} catch (err) { next(err); }
};
exports.getTasks = async (req, res, next) => {
try {
const tasks = await Task.find().sort({ createdAt: -1 });
res.json(tasks);
} catch (err) { next(err); }
};
exports.getTask = async (req, res, next) => {
try {
if (!mongoose.isValidObjectId(req.params.id))
return res.status(400).json({ error: 'Invalid id' });
const task = await Task.findById(req.params.id);
if (!task) return res.status(404).json({ error: 'Task not found' });
res.json(task);
} catch (err) { next(err); }
};
exports.updateTask = async (req, res, next) => {
try {
if (!mongoose.isValidObjectId(req.params.id))
return res.status(400).json({ error: 'Invalid id' });
const task = await Task.findByIdAndUpdate(
req.params.id,
{ title: req.body.title, done: req.body.done },
{ new: true, runValidators: true }
);
if (!task) return res.status(404).json({ error: 'Task not found' });
res.json(task);
} catch (err) { next(err); }
};
exports.deleteTask = async (req, res, next) => {
try {
if (!mongoose.isValidObjectId(req.params.id))
return res.status(400).json({ error: 'Invalid id' });
const task = await Task.findByIdAndDelete(req.params.id);
if (!task) return res.status(404).json({ error: 'Task not found' });
res.status(204).send();
} catch (err) { next(err); }
};
Step 5: Routes, app setup and a central error handler
// src/routes/taskRoutes.js
const router = require('express').Router();
const c = require('../controllers/taskController');
router.route('/').get(c.getTasks).post(c.createTask);
router.route('/:id').get(c.getTask).put(c.updateTask).delete(c.deleteTask);
module.exports = router;
// src/middleware/errorHandler.js
module.exports = (err, req, res, next) => {
if (err.name === 'ValidationError')
return res.status(400).json({ error: err.message });
console.error(err);
res.status(500).json({ error: 'Server error' });
};
// src/app.js
const express = require('express');
const taskRoutes = require('./routes/taskRoutes');
const errorHandler = require('./middleware/errorHandler');
const app = express();
app.use(express.json());
app.use('/api/tasks', taskRoutes);
app.use(errorHandler);
module.exports = app;
The order in app.js matters. express.json() must come before the routes, and the error handler must come after them.
Step 6: Test every endpoint and record the results
Send each request below and save a screenshot or a Postman collection. This becomes the evidence section of your README.
| Action | Method and path | Expected status | Edge case to try |
|---|---|---|---|
| Create | POST /api/tasks | 201 | Empty title should return 400 |
| List all | GET /api/tasks | 200 | Empty database should return [] |
| Read one | GET /api/tasks/:id | 200 | Malformed id should return 400, unknown id 404 |
| Update | PUT /api/tasks/:id | 200 | Title longer than 120 characters should return 400 |
| Delete | DELETE /api/tasks/:id | 204 | Deleting twice should return 404 the second time |
Error-fix table: common Express and MongoDB beginner problems
Most lost hours in a first project come from a handful of repeating mistakes. Match your symptom to the table before searching elsewhere.
| Symptom or message | Likely cause | Fix |
|---|---|---|
req.body is undefined |
JSON body parser missing, or registered after the routes | Add app.use(express.json()) above route mounting. In Postman, set Body to raw JSON. |
ECONNREFUSED 127.0.0.1:27017 |
Local MongoDB service is not running | Start the MongoDB service, or switch to an Atlas connection string. |
| Atlas: “bad auth” or “authentication failed” | Wrong database user or password, or special characters in the password | Re-check the user in Atlas. URL-encode special characters in the password. |
| Atlas connection times out | Your current IP is not in the Atlas network access list | Add your IP in Atlas network settings, then retry. Mobile hotspots change IPs often. |
process.env.MONGO_URI is undefined |
dotenv not loaded, or .env in the wrong folder |
Call require('dotenv').config() at the very top of server.js. Keep .env in the project root. |
CastError: Cast to ObjectId failed |
An invalid id string was passed to findById |
Check with mongoose.isValidObjectId and return 400. |
| Update returns the old document | findByIdAndUpdate returns the pre-update document by default |
Pass { new: true }. |
| Update saves invalid data | Validators do not run on update by default | Pass { runValidators: true }. |
Cannot set headers after they are sent |
Two responses sent in one request, often a missing return |
Put return before early res.status(...).json(...) calls. |
| Request hangs and never responds | An async handler threw and nothing caught it, or no response was sent |
Wrap in try/catch and call next(err). Make sure every path sends a response. |
EADDRINUSE: address already in use |
An old server process is still running on that port | Stop the old process or change PORT in .env. |
| Browser blocks the front-end request (CORS error) | Front end and API run on different origins | Install cors and use app.use(cors()) during development. Restrict origins before any deployment. |
Cannot GET /api/task |
Path typo, such as singular instead of plural | Compare the URL with the path in app.use('/api/tasks', ...). |
A 14-day plan for the Express and MongoDB project
The plan assumes two to three focused hours a day. If your college timetable leaves less time, drop the optional front-end polish on Days 11 and 12 rather than skipping testing or documentation.
| Days | Focus | Output to keep |
|---|---|---|
| 1 | Setup, Node and Git, folder template | Repository with initial commit and .gitignore |
| 2 | Express basics, routes, middleware | Working hello-world route and JSON parsing |
| 3 | MongoDB or Atlas, Mongoose connection | Successful connection log |
| 4 | Schema and model with validation | Task model file |
| 5 | Create and list endpoints | Two tested endpoints |
| 6 | Read-one, update, delete | Full CRUD in the REST client |
| 7 | Error handling, status codes, id checks | Central error handler |
| 8 | Review week one, refactor, write the README draft | Draft README with endpoint list |
| 9 | Add query features: filter by done, simple search | Query parameter handling |
| 10 | Basic front end (plain HTML and fetch, or React) | Page that lists tasks |
| 11 | Front end create, update, delete | Working UI for all operations |
| 12 | Environment config, .env.example, cleanup | Clean repository with no secrets |
| 13 | Final testing, screenshots, Postman collection | Evidence folder |
| 14 | Final README, short demo recording, submission | Submission-ready project |
Worked example: turning one bug into a README entry
This scenario is illustrative. Suppose a student calls PUT /api/tasks/:id with {"done": true} and the response shows the task still has done: false. The database record is correct, but the response is stale. The student reads the Mongoose documentation for findByIdAndUpdate, finds that the pre-update document is returned by default, and adds { new: true }. While testing again, they send an empty title and see that the update succeeds. They then add runValidators: true.
The student adds a short “Problems solved” note to the README:
- Symptom: update response showed old data.
- Cause: default return behaviour of the update method.
- Fix: added the
newoption. - Follow-up: validators do not run on updates unless enabled.
Four lines like these show an evaluator more about your thinking than a long feature list.
DDU Gorakhpur students: how project and internship credit works in the MCA structure
If you study at Deen Dayal Upadhyaya Gorakhpur University, the practical question is whether this project can count toward anything in your programme. The only course document verified for this guide is the MCA structure from the university’s Institute of Engineering and Technology, which says it is based on the AICTE Model Curriculum and effective from the 2025-26 session. It is a 2025 document, so check the current version before relying on it.
That same document sets out a 90-credit programme in which 17 credits are for project work, seminar and internship or industrial training. It lists a Mini-Project (MCAP-301, 3 credits), Industrial Training (MCAI-301, 1 credit), a Seminar (MCAS-401, 2 credits) and a Major Project (MCAP-401, 11 credits). Industrial Training and the Mini-Project sit in Semester III. In practice, a well-documented Express and MongoDB app is a reasonable candidate for a mini-project topic. The MCA core also includes Java, DBMS, Python and Software Engineering, so the project reinforces what you study.
What the document does not give is the duration of training, the evaluation method, the paperwork required, or whether an online internship qualifies. The university also runs affiliated colleges, as its affiliated-colleges page shows, so your own college or department may add rules. These details are not verified here. A free internship certificate should be treated as extra evidence of your work. Do not assume it substitutes for the university’s own training requirement, and do not assume it carries credit.
Verification steps before you commit your plan:
- Ask your department coordinator in writing whether MCAI-301 or the Mini-Project allows a self-chosen online internship, and what duration is required.
- Request the current syllabus or ordinance text for MCAI-301 and MCAP-301, and check its year against the 2025-26 structure.
- Ask what documents the evaluator expects, for example a report, a certificate, a supervisor’s letter or a viva.
- If you are at an affiliated college, ask the college’s training office whether it follows the university’s rules or has its own.
- Ask whether your project topic needs prior approval from a faculty guide, and by what date.
- Keep the reply as an email or signed note, and save it in your project folder.
Submission checklist for an Express and MongoDB internship project
- The repository runs from a fresh clone using only the README instructions.
.envis not committed, and.env.examplelists every variable.- All five CRUD endpoints return correct status codes, including for bad input.
- Validation errors return readable JSON messages, not stack traces.
- The README has an endpoint table, setup steps, screenshots and the “Problems solved” notes.
- Commits are spread across the fortnight with meaningful messages.
- A short demo recording or a set of screenshots shows each operation working.
- Your name, college and programme appear in the README, written accurately.
Extensions worth adding only if Days 1 to 7 finish early
- Pagination: use
limitandskipon the list endpoint. - Input sanitising: trim and type-check
req.bodyfields before they reach the database. - A second resource: add “categories” and a reference from task to category, which introduces
populate. - Automated tests: add a few tests for one endpoint, but state in your README only what you have actually run.
Authentication is the most common over-reach. Add it only if the rest is polished, and use a well-documented library approach rather than inventing your own password handling.
Frequently Asked Questions
Is Express with MongoDB enough for a first full stack internship project?
Yes, for a 14-day scope. A tested CRUD API with validation, error handling and a simple front end covers the core backend skills. A deeper project can follow once these basics are solid.
Should I use MongoDB Atlas or a local MongoDB install?
Atlas is usually easier, because it avoids local service and path problems and works the same on any laptop. You must add your IP address to its network access list. A local install is fine if you are comfortable starting and stopping the service.
Do I need React for this project?
No. A plain HTML page using fetch demonstrates that the API works end to end. Use React only if you already know it and can still finish the backend, testing and README on time.
Can my DDU Gorakhpur internship project count toward MCA credits?
The MCA structure has credits for a Mini-Project and Industrial Training in Semester III, but the rules on duration, evaluation and online internships are not verified here. Ask your department coordinator in writing and keep the reply.
Does the CareerSwami certificate carry academic credit?
No credit is claimed. The internship is free, runs for two weeks (14 days), and includes a free offer letter and a free completion certificate after successful completion. Whether any institution accepts it for a requirement is that institution’s decision.
Why do I get a CastError when I fetch one record?
Mongoose is being given an id string that is not a valid ObjectId, such as a typo or a missing character. Check the id with mongoose.isValidObjectId before querying and return a 400 response.
How many commits and how much documentation is enough?
There is no fixed number, but commits should appear across the days you worked, each describing one change. The README should let a stranger install, run and test your API without asking you anything.
Related Full Stack Web Development guides
- BHU Students: Cross-Disciplinary Web Projects for Internships Beyond Computer Science
- DA-IICT Students: Performance Tuning a Full Stack Internship Project With Measurable Results
- Pt. Ravishankar Shukla University Students: Writing the Internship Completion Report Day by Day
- All Full Stack Web Development internship guides
Ready to put this into practice?
Join the free two-week CareerSwami online internship in Full Stack Web Development. The internship, the offer letter and the completion certificate are free.














