Skip to content

martinapapp/devMatch

Repository files navigation

DevMatch

NestJS TypeScript Node.js License: MIT

A developer-themed dating profile REST API — think Tinder, but for coders. Browse, create, update, and delete developer profiles through a clean NestJS backend. link here

Index


About

DevMatch is a RESTful API for managing developer dating profiles. The main goal was to learn how to:

  • Build a REST API with NestJS and its module/controller/service architecture
  • Understand the role of controllers, services, and modules and how they connect
  • Use DTOs (Data Transfer Objects) to shape incoming request data
  • Handle errors gracefully with NotFoundException from @nestjs/common
  • Use decorators like @Get, @Post, @Put, @Delete, @Param, @Body to define routes
  • Use randomUUID() from Node's built-in crypto module for ID generation
  • Test endpoints manually with curl scripts

Usage

Installation

  1. Clone the repository:

    git clone <your-repo-url>
    cd devmatch
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm run start:dev
  4. The API will be running at http://localhost:3000

Commands

Here are the main scripts available:

npm run start:dev   // Starts the server in watch mode (auto-restarts on changes).
npm run build       // Compiles the TypeScript project for production.
npm run start:prod  // Runs the compiled production build.
npm test            // Runs all unit tests.
npm run test:e2e    // Runs end-to-end tests.
npm run lint        // Lints and auto-fixes code style issues.

API Endpoints

Method Endpoint Description
GET /profiles Get all profiles
GET /profiles/:id Get a single profile by UUID
POST /profiles Create a new profile
PUT /profiles/:id Update an existing profile
DELETE /profiles/:id Delete a profile (returns 204)

Example POST body:

{
  "name": "Kai",
  "description": "This is the description"
}

Development

Pre-Requisites

  • Node.js (v18+)
  • npm
  • A text editor (VS Code recommended)
  • A REST client for manual testing (curl, Postman, or Insomnia)

File Structure

No File Name What it does
1 src/main.ts Entry point — bootstraps the app and registers the global ValidationPipe
2 src/app.module.ts Root module — imports ProfilesModule
3 src/app.controller.ts Handles the root GET / route
4 src/app.service.ts Returns the "Hello World!" string
5 src/profiles/profiles.module.ts Wires together the profiles controller and service
6 src/profiles/profiles.controller.ts Defines all /profiles routes and maps them to the service
7 src/profiles/profiles.service.ts Contains business logic — in-memory CRUD operations on profiles
8 src/profiles/dto/create-profile.dto.ts DTO for POST requests — validates name (3–100 chars) and description
9 src/profiles/dto/update-profile.dto.ts DTO for PUT requests — validates name (min 3 chars) and description
10 test/app.e2e-spec.ts End-to-end test for the root route
11 post.sh / put.sh / delete.sh curl scripts for manual endpoint testing

Build

The app uses the NestJS CLI to compile TypeScript into a dist/ folder. By default it uses the TypeScript compiler, which can be slow on the first run. You can switch to SWC (a faster Rust-based compiler) by adding "builder": "swc" to nest-cli.json — it's already installed as a dependency. Note that SWC skips type checking, but for a learning project that's fine.


Contribution

  1. Found a bug? Open an issue and I'll try to fix it.
  2. Advice? If you have ideas for new profile features or API improvements, let me know!

Guideline

Keep controllers thin — business logic belongs in the service. When adding new fields, update the relevant DTO and add appropriate class-validator decorators. Make sure npm test passes before opening a pull request.


License

Feel free to use this for your own practice! MIT License.

About

A developer-themed dating profile REST API — think Tinder, but for coders. Browse, create, update, and delete developer profiles through a clean NestJS backend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors