Skip to content

mgalen007/DevLink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DevLink

A developer collaboration platform API built with TypeScript, Express, and MongoDB. DevLink enables developers to create projects, apply to join projects, send messages, and manage their professional profiles.

πŸš€ Features

  • User Authentication - Register and login with JWT tokens
  • Project Management - Create, list, and manage development projects
  • Project Applications - Apply to projects and manage application status
  • Messaging System - Direct messaging between developers
  • User Profiles - Showcase skills, bio, and GitHub links
  • Security - Password hashing, helmet headers, CORS, and request logging

πŸ› οΈ Technology Stack

  • Runtime: Node.js
  • Framework: Express.js 5.2.1
  • Language: TypeScript 6.0.2
  • Database: MongoDB with Mongoose 9.4.1
  • Authentication: JWT (jsonwebtoken 9.0.3)
  • Security: Bcryptjs, Helmet, CORS
  • Development: ts-node-dev for hot-reloading
  • Logging: Morgan for HTTP request logging

πŸ“ Project Structure

src/
β”œβ”€β”€ app.ts                 # Express app setup and routing
β”œβ”€β”€ server.ts              # Server bootstrap and database connection
β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ auth.middleware.ts # JWT authentication middleware
β”‚   └── error.middleware.ts # Centralized error handling
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ auth/              # Authentication module
β”‚   β”‚   β”œβ”€β”€ auth.controller.ts
β”‚   β”‚   β”œβ”€β”€ auth.service.ts
β”‚   β”‚   β”œβ”€β”€ auth.routes.ts
β”‚   β”‚   β”œβ”€β”€ auth.dto.ts
β”‚   β”‚   └── auth.types.ts
β”‚   β”œβ”€β”€ users/             # User management module
β”‚   β”‚   β”œβ”€β”€ users.controller.ts
β”‚   β”‚   β”œβ”€β”€ users.service.ts
β”‚   β”‚   β”œβ”€β”€ users.routes.ts
β”‚   β”‚   β”œβ”€β”€ users.model.ts
β”‚   β”‚   β”œβ”€β”€ users.dto.ts
β”‚   β”‚   └── users.types.ts
β”‚   β”œβ”€β”€ projects/          # Project management module
β”‚   β”‚   β”œβ”€β”€ projects.controller.ts
β”‚   β”‚   β”œβ”€β”€ projects.service.ts
β”‚   β”‚   β”œβ”€β”€ projects.routes.ts
β”‚   β”‚   β”œβ”€β”€ projects.model.ts
β”‚   β”‚   β”œβ”€β”€ projects.dto.ts
β”‚   β”‚   └── projects.types.ts
β”‚   β”œβ”€β”€ applications/      # Project applications module
β”‚   β”‚   β”œβ”€β”€ applications.controller.ts
β”‚   β”‚   β”œβ”€β”€ applications.service.ts
β”‚   β”‚   β”œβ”€β”€ applications.routes.ts
β”‚   β”‚   β”œβ”€β”€ applications.model.ts
β”‚   β”‚   β”œβ”€β”€ applications.dto.ts
β”‚   β”‚   └── applications.types.ts
β”‚   └── messages/          # Messaging module
β”‚       β”œβ”€β”€ messages.controller.ts
β”‚       β”œβ”€β”€ messages.service.ts
β”‚       β”œβ”€β”€ messages.routes.ts
β”‚       β”œβ”€β”€ messages.model.ts
β”‚       β”œβ”€β”€ messages.dto.ts
β”‚       └── messages.types.ts
β”œβ”€β”€ config/                # Configuration files
└── structure.md           # Project structure documentation

πŸ—οΈ Architecture

DevLink follows a modular layered architecture where each feature is organized into its own module. Each module contains:

  • Controller - Handles HTTP requests and responses
  • Service - Contains business logic
  • Routes - Defines API endpoints
  • Model - Mongoose database schemas
  • DTO - Data transfer objects for request/response validation
  • Types - TypeScript interfaces and types

πŸ“‘ API Endpoints

Authentication

  • POST /api/auth/register - Create new user account
  • POST /api/auth/login - Authenticate and get JWT token

Users

  • GET /api/users - Get current user profile
  • PATCH /api/users/:id - Update user profile

Projects

  • POST /api/projects - Create a new project
  • GET /api/projects - List all projects
  • GET /api/projects/:id - Get single project details
  • PATCH /api/projects/:id - Update project (owner only)
  • DELETE /api/projects/:id - Delete project (owner only)

Applications

  • POST /api/applications - Apply to a project
  • GET /api/applications - Get applications for owned projects
  • PATCH /api/applications/:id - Update application status (accept/reject)

Messages

  • POST /api/messages - Send a message
  • GET /api/messages - Get conversation messages

Health Check

  • GET /api/health-check - API status check

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or cloud instance)
  • npm or yarn

Installation

  1. Clone the repository:
git clone <repository-url>
cd devlink
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory:
MONGODB_URI=mongodb://localhost:27017/devlink
PORT=3000
JWT_SECRET_KEY=your-super-secret-jwt-key
  1. Start the development server:
npm run dev

The API will be available at http://localhost:3000

πŸ“œ Available Scripts

  • npm run dev - Start development server with hot-reload
  • npm run build - Compile TypeScript to JavaScript
  • npm start - Run the compiled application

πŸ”’ Authentication

All endpoints except authentication routes require a JWT token. Include the token in the Authorization header:

Authorization: Bearer <your-jwt-token>

Tokens expire after 3 days.

πŸ—„οΈ Data Models

User

{
  username: string;
  email: string;
  password: string; // hashed
  bio?: string;
  skills?: string[];
  githubLink?: string;
  createdAt: Date;
  updatedAt: Date;
}

Project

{
  title: string;
  description: string;
  techStack: string[];
  owner: ObjectId; // User reference
  createdAt: Date;
  updatedAt: Date;
}

Application

{
  applicant: ObjectId; // User reference
  project: ObjectId; // Project reference
  status: "pending" | "accepted" | "rejected";
  createdAt: Date;
  updatedAt: Date;
}

Message

{
  sender: ObjectId; // User reference
  recipient: ObjectId; // User reference
  content: string;
  createdAt: Date;
}

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.

About

A developer collaboration API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors