BBAU Students: Building a REST API Step by Step for Your Internship Project

Facebook
Twitter
LinkedIn
WhatsApp
Email

To build a REST API for a student-notes app, start by listing your resources (users, notes, tags), give each one a plural noun URL, map actions to HTTP methods, and decide the status code and validation rule for every endpoint before writing code. Then build in thin slices: one resource, one test list, one commit at a time. This guide gives you a full API design sheet, a Postman-style test list and a 14-day plan that fits a short internship.

What a Student-Notes API Needs to Do

A notes app is a good internship project because it is small enough to finish and large enough to show real backend skills: relationships, validation, authentication, filtering and error handling. The app we design here lets a student register, log in, create notes under a subject, tag notes, search them and delete them.

Keep the scope honest. A reviewer would rather see eight endpoints that behave correctly than twenty that return 200 for everything. The core scope:

  • Auth: register and log in, receiving a token.
  • Notes: create, list (with search and pagination), read one, update, delete.
  • Subjects: group notes by subject, such as “Data Structures” or “Operating Systems”.
  • Tags (optional stretch): label notes for filtering.

Step 1: Name Your Resources and URLs

REST treats everything as a resource identified by a URL. Use plural nouns, no verbs in the path, and lowercase with hyphens.

  • Good: /api/v1/notes, /api/v1/notes/42, /api/v1/subjects/3/notes
  • Avoid: /api/getAllNotes, /api/createNote, /api/Note_Delete?id=42

Put a version in the path (/v1/) from day one. It costs nothing and shows you have thought about change.

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.

Apply for the free internship

Step 2: Fill In the API Design Sheet Before Coding

This is the main asset of the guide. Copy it into a document or README and complete it before you open your editor. Every row names the method, the path, who can call it, the success code and the failure codes you promise to handle.

Endpoint Method Auth Request body / query Success Failure codes
/api/v1/auth/register POST No name, email, password 201 Created 400 invalid input, 409 email exists
/api/v1/auth/login POST No email, password 200 OK + token 400 missing field, 401 wrong credentials
/api/v1/subjects POST Yes name 201 Created 400, 401, 409 duplicate name
/api/v1/subjects GET Yes none 200 OK 401
/api/v1/notes POST Yes title, content, subjectId 201 Created + Location header 400, 401, 404 subject not found
/api/v1/notes GET Yes ?q, ?subjectId, ?page, ?limit 200 OK 400 bad query, 401
/api/v1/notes/:id GET Yes none 200 OK 401, 404 (also for another user’s note)
/api/v1/notes/:id PUT or PATCH Yes title and/or content 200 OK 400, 401, 404
/api/v1/notes/:id DELETE Yes none 204 No Content 401, 404

Why these status codes

  • 201 vs 200: use 201 when a new record is created; return the new object and a Location header.
  • 204: a successful delete has nothing to return.
  • 400 vs 422: pick one convention for validation errors and apply it everywhere. This guide uses 400.
  • 401 vs 403: 401 means “we do not know who you are”; 403 means “we know you, but you may not do this”.
  • 404 for other people’s notes: returning 404 rather than 403 avoids confirming that a note ID exists for someone else.
  • 409: a conflict with existing data, such as a duplicate email.
  • 500: never a deliberate response. If you see one in testing, treat it as a bug to fix.

Step 3: Write Validation Rules as a Table

Validation belongs at the edge of your API, before data touches the database. Write the rules down so your code and your tests share one source of truth.

Field Rule Error message (illustrative)
email Required, valid format, lowercased, unique “Enter a valid email address”
password Required, minimum 8 characters, stored only as a hash “Password must be at least 8 characters”
title Required, string, 1 to 120 characters after trimming “Title is required and must be under 120 characters”
content Optional, string, up to 10,000 characters “Content is too long”
subjectId Required, integer, must exist and belong to the user “Subject not found”
page / limit Positive integers; limit capped at 50 “limit must be between 1 and 50”

Return errors in one consistent shape so a front end can rely on it:

{
  "error": "ValidationError",
  "message": "Request body is invalid",
  "details": [
    { "field": "title", "issue": "Title is required" }
  ]
}

Libraries such as Joi, Zod or express-validator handle this in Node.js; Django REST Framework serializers and Pydantic in FastAPI do the same elsewhere. The rule table matters more than the library you choose.

Step 4: Set Up the Project Structure

Whatever stack you use, separate concerns so each file has one job. A typical layout for Node.js with Express:

  • routes/: URL and method mapping only.
  • controllers/: read the request, call a service, send the response.
  • services/ or models/: database logic.
  • middleware/: authentication, validation, error handler.
  • .env: secrets and database URL, never committed to Git.

Add a .gitignore and a README on day one. Commit small and often; a visible history is part of your evidence of work.

Step 5: Build in Vertical Slices

  1. Health check: GET /health returns 200. This proves the server runs.
  2. Register and login: hash passwords with bcrypt, issue a signed token (for example a JWT) with an expiry.
  3. Auth middleware: reject requests with a missing or invalid token using 401.
  4. Subjects: the simplest CRUD, good for practising the pattern.
  5. Notes: every query filters by the logged-in user’s ID. This one habit prevents the most common data-leak bug in beginner APIs.
  6. Search and pagination: add ?q=, ?page= and ?limit= last.
  7. Central error handler: one middleware that converts thrown errors into the consistent JSON shape above.

Worked Example: One Endpoint From Design to Response

This example is illustrative. It shows the expected behaviour of the design, not output from a run.

Endpoint: POST /api/v1/notes. The student is logged in and sends:

POST /api/v1/notes
Authorization: Bearer <token>
Content-Type: application/json

{
  "title": "B-Tree insertion rules",
  "content": "Split a node when it exceeds the maximum keys...",
  "subjectId": 3
}

Expected behaviour, in the order the code should check things:

  1. Auth middleware verifies the token. Failure: 401.
  2. Validation checks title length and subjectId type. Failure: 400 with a details array.
  3. Service looks up subject 3 for this user. Not found: 404.
  4. Note is saved with the user’s ID attached.
  5. Response: 201 Created, header Location: /api/v1/notes/58, and body:
{
  "id": 58,
  "title": "B-Tree insertion rules",
  "content": "Split a node when it exceeds the maximum keys...",
  "subjectId": 3,
  "createdAt": "2026-11-13T09:30:00Z"
}

Notice the order: authenticate, validate, authorise or look up, act, respond. Use the same order for every endpoint.

Step 6: Run This Postman-Style Test List

Build a Postman (or Thunder Client, Insomnia or curl) collection from the table below. Save a token as a collection variable so later requests reuse it. Tick each test only after you have actually run it against your own API.

# Request Expected result
1 GET /health 200
2 POST /auth/register with valid data 201, no password in the response
3 POST /auth/register with the same email 409
4 POST /auth/register with a 5-character password 400 with field details
5 POST /auth/login with a wrong password 401
6 POST /auth/login with correct details 200 and a token
7 GET /notes with no token 401
8 POST /notes with empty title 400
9 POST /notes with a non-existent subjectId 404
10 POST /notes with valid data 201 and a Location header
11 GET /notes/:id for your own note 200
12 GET /notes/:id using a second user’s token 404
13 GET /notes/99999 404
14 GET /notes/abc 400, not a 500 crash
15 PATCH /notes/:id with a new title 200 and updated data
16 GET /notes?q=btree&page=1&limit=5 200 and at most 5 results
17 GET /notes?limit=1000 400
18 DELETE /notes/:id 204
19 DELETE the same note again 404
20 Send malformed JSON 400 in your standard error shape

Add Postman test scripts for at least tests 6, 10 and 18, for example asserting pm.response.to.have.status(201). Export the collection as JSON and commit it to your repository.

Step 7: Document and Secure the API Before You Submit

  • Write a README with setup steps, environment variables (names only), and a table of endpoints.
  • Never return password hashes. Check every response body.
  • Enable CORS only for the origins your front end uses.
  • Add rate limiting on login if time allows.
  • Use parameterised queries or an ORM so user input never goes straight into SQL.
  • Provide a .env.example file with blank values.

A 14-Day Plan for the Notes API

A two-week online internship is short, so the plan below is tight. The free two-week CareerSwami internship runs for 14 days with a free offer letter and a free completion certificate after successful completion, and this schedule is designed to fit that window.

Days Focus Output
1 Scope and design Completed API design sheet and validation table
2 Setup Repo, folder structure, health check, database connection
3-4 Auth Register, login, token middleware, tests 1-7
5-6 Subjects and notes create/read Tests 8-13 passing
7-8 Update, delete, ownership checks Tests 14-19 passing
9-10 Search, pagination, central error handler Test 20 and query tests
11 Security pass Checklist from Step 7 complete
12 Deploy or run locally with Docker Reproducible setup
13 Documentation README, exported Postman collection
14 Review and submit Final commit, short demo video or screenshots

BBAU Internship Rules and Your API Project: What the Ordinances Say

If you are hoping an internship project like this will count towards your degree, the university’s own rules matter more than any blog. BBAU describes itself as “A Central University” at Vidya Vihar, Raebareli Road, Lucknow, and its ordinances set the internship framework.

The UG Academic Ordinance for session 2025-26, as seen in a search excerpt, says internship credit is one credit per week, subject to a maximum of six. It also says the internship runs for the period specified in the scheme of teaching, with progress submitted to a faculty guide. The excerpt does not explicitly mention online internships, so do not assume a two-week online programme carries credit. Credit, if any, depends on your department approving it.

The PG ordinance similarly sets one credit per week with a cap, and says project or internship credits are as mentioned by the Department. It also has a Research Project Work clause (13.1.11) that lets students choose a major project with a mentor’s recommendation, which could be a natural home for a larger API-based project. These are excerpt-based facts, so read the current ordinance yourself.

For job preparation, the University Central Placement Cell says it trains students in aptitude tests and interview techniques and offers career guidance. A documented API project with a README and test collection gives you something concrete to talk about in those sessions. Nothing here promises placement.

Five steps to verify before you count this project towards anything

  1. Download the current UG or PG ordinance from the BBAU website and read the internship clause in full, not just the credit line.
  2. Email your department coordinator asking in writing whether an online, self-directed internship is acceptable for credit, and who must approve it.
  3. Ask your faculty guide what evidence they need: report format, attendance proof, supervisor letter, or project demo.
  4. Ask when in your semester the internship period must fall, and whether the department sets a duration longer than two weeks.
  5. Check the current academic calendar on the BBAU calendar page so your 14 days do not clash with exams or classes.

Frequently Asked Questions

Should I use PUT or PATCH to update a note?

Use PUT when the client sends the complete note and replaces it, and PATCH when it sends only changed fields. For a notes app, PATCH is usually friendlier because a student edits just the title or content. Whichever you choose, document it in the design sheet and test it.

Which database should I pick for a student-notes API?

A relational database such as PostgreSQL or MySQL fits well because notes belong to subjects and users. MongoDB also works if you are comfortable with it. Choose the one you can set up quickly in two weeks, and keep the design sheet independent of that choice.

Should a missing note return 404 or 403 when it belongs to another user?

Returning 404 is a common choice because it does not reveal that the note exists. Use 403 only where a user can legitimately know a resource exists but lacks permission, such as a shared note that is read-only.

How do I handle pagination without over-engineering it?

Accept page and limit, default to page 1 and limit 10, cap the limit at 50, and return the items plus a total count. That is enough for an internship project. Cursor-based pagination can be mentioned in your README as future work.

Do I need a front end for the internship project?

Not necessarily. A well-tested API with a clear README and Postman collection is a complete backend deliverable. If you have spare time, a simple HTML or React page that calls two or three endpoints makes the demo more convincing.

How do I store passwords safely?

Never store plain text. Hash each password with bcrypt or Argon2 before saving, compare using the library’s compare function at login, and never include the hash in any response.

Will this project earn academic credit at BBAU?

The ordinances mention internship credit of one credit per week with a cap, but whether a self-directed online internship qualifies is not confirmed in the excerpts reviewed. CareerSwami’s internship provides a free offer letter and a free completion certificate, not academic credit. Ask your department in writing before you rely on it.

What should I put in my README so reviewers can run the API quickly?

Include a one-paragraph description, the tech stack, setup commands, the names of required environment variables, how to run the server and the tests, and your endpoint table. Link the exported Postman collection so a reviewer can reproduce your test list in minutes.

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.

Start your free 2-week internship

Web Stories

Scroll to Top