https://github.com/larissadantier/server-tasks
Practice concepts with CRUD of Tasks
https://github.com/larissadantier/server-tasks
biome csv csv-stringifier docker fastify node postgresql
Last synced: 3 months ago
JSON representation
Practice concepts with CRUD of Tasks
- Host: GitHub
- URL: https://github.com/larissadantier/server-tasks
- Owner: larissadantier
- Created: 2025-06-02T22:04:09.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-08T00:28:45.000Z (about 1 year ago)
- Last Synced: 2025-07-02T20:41:46.407Z (12 months ago)
- Topics: biome, csv, csv-stringifier, docker, fastify, node, postgresql
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Tech Stack |
Task Manager API |
License
## 📝 Task Manager API
A simple RESTful API for managing tasks (CRUD + bulk import via CSV).
## 💾 Tech Stack
- [Node.js](https://nodejs.org/en)
- [Fastify](https://fastify.dev)
- [Postgresql](https://www.postgresql.org)
- [Docker](https://www.docker.com)
- File handling for CSV import
## 📌 Features
- Create a task
- List all tasks (with optional search)
- Update a task by `id`
- Delete a task by `id`
- Mark/unmark a task as completed
- Import tasks in bulk using a CSV file
## 📦 Task Structure
Each task has the following properties:
| Field | Type | Description |
|---------------|---------------|--------------------------------------------------------------|
| `id` | string | Unique identifier for the task |
| `title` | string | Task title |
| `description` | string | Detailed task description |
| `completed_at`| datetime/null | Timestamp when the task was completed (initially `null`) |
| `created_at` | datetime | Timestamp when the task was created |
| `updated_at` | datetime | Timestamp when the task was last updated |
## 🚀 API Endpoints
### `POST /tasks`
Create a new task.
**Request Body:**
```json
{
"title": "Task Title",
"description": "Task Description"
}
```
**Behavior:**
- `id`, `created_at`, and `updated_at` are auto-generated.
- `completed_at` is initially set to `null`.
### `GET /tasks`
List all tasks. Supports optional filtering by `title` and/or `description`.
**Query Params (optional):**
```
?title=example&description=details
```
### `PUT /tasks/:id`
Update a task's `title` and/or `description`.
**Request Body:**
```json
{
"title": "Updated Title",
"description": "Updated Description"
}
```
**Rules:**
- You can update either `title`, `description`, or both.
- `updated_at` is updated on change.
- Must validate the task exists before updating.
### `DELETE /tasks/:id`
Delete a task by `id`.
**Rules:**
- Validate task existence before deletion.
### `PATCH /tasks/:id/complete`
Toggle a task’s completion status.
**Behavior:**
- If `completed_at` is `null`, set it to the current timestamp.
- If `completed_at` has a value, reset it to `null`.
### `GET /tasks/export-csv`
Bulk import tasks from a CSV file.
**CSV Format:**
```
id,title,description
1,Task 1,Description for Task 1
2,Task 2,Description for Task 2
...
```
**Behavior:**
- All imported tasks follow the same creation rules as `POST /tasks`.
## 🛠️ Setup & Run
```bash
# Clone the repository
git clone https://github.com/larissadantier/server-tasks.git
# Install all packages
- Npm
npm install
- Yarn
yarn install
- Pnpm
pnpm install
After all this, you're ready to run the project, just enter the command:
- Docker
pnpm docker:up
- Npm
npm run dev
- Yarn
yarn dev
- Pnpm
pnpm dev
- Bun
bun dev
All done! Now your application will run 😄
```
## 🧪 Testing (Optional)
You can use tools like [Postman](https://www.postman.com), [Insomnia](https://insomnia.rest) or [Yaak](https://yaak.app) to test each route.
## 📝 License
This project is under the MIT license. See the [LICENSE](LICENSE) file for more details.
## 👀 Autor
Developed por Larissa Dantier 🚀
Contact us 👏