https://github.com/jagthefriend/smart-task-planner-app
A backend for a productivity web application
https://github.com/jagthefriend/smart-task-planner-app
backend-api echo golang gorm jwt postrgesql
Last synced: 2 months ago
JSON representation
A backend for a productivity web application
- Host: GitHub
- URL: https://github.com/jagthefriend/smart-task-planner-app
- Owner: JagTheFriend
- License: cc0-1.0
- Created: 2026-02-11T13:46:30.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2026-02-11T14:27:52.000Z (5 months ago)
- Last Synced: 2026-02-11T22:36:41.203Z (5 months ago)
- Topics: backend-api, echo, golang, gorm, jwt, postrgesql
- Language: Go
- Homepage:
- Size: 50.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Smart Task Planner API
Smart Task Planner is a RESTful backend service built with Go, Echo v5, GORM, and PostgreSQL. It provides JWT-based authentication and task management functionality, allowing users to securely create, retrieve, update, and delete tasks.
## Technology Stack
* Go (Golang)
* Echo v5 (HTTP Framework)
* GORM (ORM)
* PostgreSQL
* JWT (Authentication)
---
## Features
* User registration
* User login with JWT token generation
* Protected task routes
* Create task
* Get all tasks (user-specific)
* Update task (partial updates supported)
* Delete task
* Ownership protection (users can access only their tasks)
---
## Environment Variables
Create a `.env` file or configure environment variables:
```
PORT=3000
DB_DSN=host=your_host user=your_user password=your_password dbname=your_db port=5432 sslmode=require TimeZone=UTC
JWT_KEY=your_secret_key
```
---
## Installation
### 1. Clone the repository
```
git clone https://github.com/JagTheFriend/Smart-Task-Planner-App.git
cd smart-task-planner
```
### 2. Install dependencies
```
go mod tidy
```
### 3. Run the application
```
go run main.go
```
Server will start on:
```
http://localhost:3000
```
---
## API Endpoints
Base path:
```
/api/v1
```
---
### Authentication
#### Signup
```
POST /api/v1/auth/signup
```
Request Body:
```json
{
"name": "John Doe",
"email": "john@example.com",
"password": "password123"
}
```
---
#### Login
```
POST /api/v1/auth/login
```
Request Body:
```json
{
"email": "john@example.com",
"password": "password123"
}
```
Response:
```json
{
"message": ""
}
```
---
### Task Management
All task routes require:
```
Authorization: Bearer
```
---
#### Create Task
```
POST /api/v1/task
```
Request Body:
```json
{
"title": "Complete API",
"description": "Implement CRUD operations",
"deadline": "2026-02-20T18:00:00Z"
}
```
---
#### Get Tasks
```
GET /api/v1/task
```
Returns all tasks belonging to the authenticated user.
---
#### Update Task
```
PUT /api/v1/task
```
Request Body:
```json
{
"id": 1,
"title": "Updated Title",
"completed": true
}
```
Only `id` is required. Other fields are optional.
---
#### Delete Task
```
DELETE /api/v1/task?id=1
```
---
## Security
* JWT-based authentication
* Route protection using middleware
* User-specific task isolation
* Secure password handling (recommended: hash before storing)
---
## Error Handling
* Structured error responses
* Proper HTTP status codes
* Panic recovery middleware enabled