Skip to content

Alex-Gekas/developer-task-api

Repository files navigation

Task API

A production-style REST API for managing tasks with JWT authentication.

Project purpose

This project was created as part of a technical writing portfolio to demonstrate documentation for a working REST API, including onboarding guides, reference material, and troubleshooting documentation.

Full documentation: see the /docs directory.

Start with:
docs/index.md — Developer documentation entry point

What this repository demonstrates

  • Documenting a functioning REST API
  • Testing endpoints using Postman
  • Designing developer onboarding workflows
  • Structuring documentation using docs-as-code practices

API capabilities

  • User signup and login with hashed passwords
  • JWT-based authentication on all task endpoints
  • Full task CRUD: create, read, update, delete
  • Filter tasks by status or priority
  • Centralized error handling

Project structure

task-api/
├── src/
│   ├── server.js                  # App entry point
│   ├── db/
│   │   └── database.js            # SQLite connection & table setup
│   ├── middleware/
│   │   ├── auth.js                # JWT verification middleware
│   │   └── errorHandler.js        # Global error handler
│   ├── controllers/
│   │   ├── authController.js      # Signup & login logic
│   │   └── taskController.js      # Task CRUD logic
│   └── routes/
│       ├── auth.js                # Auth route definitions
│       └── tasks.js               # Task route definitions
├── .env.example                   # Environment variable template
├── .gitignore
└── package.json

Example request

Create a task:

curl -X POST http://localhost:3000/api/tasks 
  -H "Authorization: Bearer <token>" 
  -H "Content-Type: application/json" 
  -d '{
    "title": "Write documentation",
    "priority": "high"
  }'

Quick Start

1. Install dependencies

npm install

2. Set up environment variables

cp .env.example .env
# Edit .env and set a strong JWT_SECRET

3. Start the server

npm run dev     # with auto-reload (requires nodemon)
npm start       # standard start

The server starts at http://localhost:3000.

Documentation

Full developer documentation is available in the /docs folder.

Start here:

  • docs/index.md — documentation overview
  • docs/getting-started.md — onboarding guide
  • docs/authentication-guide.md — JWT walkthrough
  • docs/api-reference.md — full endpoint documentation
  • docs/troubleshooting.md — common problems and fixes

Documentation Scope

This repository includes a working task management API used to demonstrate professional developer documentation practices.

The focus of this project is the documentation system, including onboarding guides, authentication walkthroughs, endpoint reference material, and troubleshooting documentation.

The API endpoints were tested using real HTTP requests via Postman and documented using a docs-as-code workflow.

Endpoints

Method Path Auth Required Description
GET /health No Health check
POST /api/auth/signup No Register new user
POST /api/auth/login No Login, receive JWT
GET /api/tasks Yes List your tasks
POST /api/tasks Yes Create a task
GET /api/tasks/:id Yes Get one task
PATCH /api/tasks/:id Yes Update a task
DELETE /api/tasks/:id Yes Delete a task

Authentication

After login, include the token in all task requests:

Authorization: Bearer <your_token_here>

Task Fields

Field Type Values Required
title string Any text Yes
description string Any text No
status string pending, in_progress, completed No
priority string low, medium, high No
due_date string ISO date, e.g. 2024-12-31 No

License

MIT License — see the LICENSE file for details.

Node.js Docs License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors