Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# macOS
.DS_Store

# Environment files
.env
.env.*
frontend/.env
backend/.env

# Logs
*.log
logs/

# Node / Vite / Svelte
frontend/node_modules/
frontend/dist/
frontend/.vite/
frontend/.svelte-kit/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Go build artifacts
backend/bin/
backend/tmp/
backend/coverage/
backend/*.out

# Local database files (keep committed sample db.json; ignore local variants)
backend/db.local.json
backend/data/*.json

# IDE caches (keep tracked settings if any)
.idea/
.pytest_cache/
.cache/
Comment on lines +36 to +37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These patterns seem either unrelated to the project's tech stack or too broad, which could lead to unintentionally ignoring important files.

  • .pytest_cache/ is a cache directory for pytest, a Python testing framework. Since this is a Go and JavaScript project, this line is unnecessary.
  • .cache/ is a very generic pattern and could match cache directories from various tools that you might want to keep, or it could be too broad and catch something unexpected in the future. It's better to specify caches for tools you are actually using, e.g., frontend/.vite/ which is already present.
.idea/

109 changes: 83 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,104 @@
Create the foundation of a to-do list application, focusing on backend functionality and essential frontend interaction. Your task is implementing a RESTful API using Go and a simple TypeScript interface using [Svelte](https://svelte.dev/). The goal is to be able to be able to list and add todos.
# Kanban Taskboard — Go + Svelte

You are not expected to know Go, Svelte, or OpenAPI. Part of the challenge is to see how quickly you can adapt and pick new things up!
This project is a Kanban-style task board with a Go backend and a Svelte frontend. Tasks are persisted to a local JSON file and exposed via REST endpoints. The UI supports columns (Kanban statuses), drag-and-drop, inline editing, and a calendar view for deadlines.

The backend needs to meet the openapi spec which is within the backend folder. You need to create the list endpoint and the add todo endpoint. The storage system is in-memory.
## Overview

The frontend already has functionality to list the todos, your task is to complete the form which submits todo's to the backend system.
- Backend (Go): JSON file–backed store with REST endpoints for `kanban` (columns) and `tasks`.
- Frontend (Svelte): Loads columns and tasks from the backend, persists all edits (add/update/move/delete), and caches to `localStorage` as a fallback.
- Data models:
- `kanban`: `{ id, title }[]`
- `tasks`: `{ id, name, description, priority, deadline, status_id, position }[]`

Please use this repo as your base. You can click "Use this template" in the top right on GitHub, then "Create a new repository". Commit and push your code so it can reviewed by us. Please get as far as you can within 2 hours.
## Setup

If you find anything in the template you would like to improve, please feel free to!
Install:
- Go ([install instructions](https://go.dev/doc/install))
- Node.js + npm (we recommend [NVM](https://github.com/nvm-sh/nvm))

Tested with Go 1.25 and Node 20.

## Setup
## Running

If not already installed, please install the following:
1. Go ([install instructions](https://go.dev/doc/install))
2. NPM/NodeJS. We recommend using [NVM](https://github.com/nvm-sh/nvm)
Open two terminals: one for the backend, one for the frontend.

We have tested this with Go 1.25 and Node 20. You may have issues if you try to use a different version.
### Backend (Go)

A good starting point would be to look at the following files:
- `backend/main.go`
- `frontend/src/App.svelte`
1. `cd backend`
2. `go run .`

## Running
Environment:
- `PORT` (optional): default `8080`
- `DB_FILE` (optional): path to JSON file, default `db.json`

On first run, if `DB_FILE` is missing, sample columns are created and the file is saved.

### Frontend (Svelte)

1. `cd frontend`
2. `npm install`
3. `npm run dev`
4. Open `http://localhost:5174/`

Configuration:
- `VITE_API_BASE_URL` (optional): API base, default `http://localhost:8080`

## REST API

Base URL: `http://localhost:8080`

### Columns (Kanban)

- `GET /api/kanban` → `[{ id, title }]`
- `POST /api/kanban` body: `{ title }` → created column
- `PATCH /api/kanban/{id}` body: `{ title }` → updated column
- `DELETE /api/kanban/{id}` → deletes column and cascades tasks in that column

### Tasks

- `GET /api/tasks` → `[{ id, name, description, priority, deadline, status_id, position }]`
- `POST /api/tasks` body: `{ name, description, priority, deadline, status_id }` → created task
- `PATCH /api/tasks/{id}` body: any subset of fields (partial update)
- `DELETE /api/tasks/{id}` → deletes task

Notes:
- Task positions are maintained per column; new tasks are appended to the end.
- Partial updates do not overwrite omitted fields.

## Frontend Behavior

Open two separate terminals - one for the Svelte app and one for the golang API.
- Kanban board: add/rename/delete columns; add/edit/move/delete tasks; drag to reorder.
- Calendar view: tasks appear on their `deadline` date; dragging a task to a new date updates only `deadline`.
- All changes persist to the backend and cache to `localStorage`.

## Quick Test (curl)

### Golang API
```bash
# List columns
curl http://localhost:8080/api/kanban

1. In the first terminal, change to the backend directory (`cd backend`)
2. Run `go run main.go` to start the API server
# Create a column
curl -X POST http://localhost:8080/api/kanban \
-H 'Content-Type: application/json' \
-d '{"title":"Backlog"}'

This must be running for the frontend to work.
# Create a task in column id "todo"
curl -X POST http://localhost:8080/api/tasks \
-H 'Content-Type: application/json' \
-d '{"name":"Write report","description":"Q4 summary","priority":"Medium","deadline":"2025-11-20","status_id":"todo"}'

When you make a change, you must stop the server (`ctrl-c` in the terminal), and restart it with `go run main.go`.
# Move task and change deadline (partial update)
curl -X PATCH http://localhost:8080/api/tasks/{task_id} \
-H 'Content-Type: application/json' \
-d '{"status_id":"inprogress","deadline":"2025-11-22"}'
```

## Files of Interest

### Svelte App
- Backend: `backend/main.go` (HTTP handlers, JSON DB), `backend/db.json` (data file)
- Frontend: `frontend/src/lib/components/Kanban.svelte`, `frontend/src/lib/components/CalendarView.svelte`, `frontend/src/lib/stores/taskboard.js`

1. In the second terminal, change to the frontend directory (`cd frontend`)
2. Run `npm run dev` to start the Svelte app
3. If it doesn't open automatically, open [http://localhost:5173](http://localhost:5173) to view your website
## Troubleshooting

Leave this running. It will automatically update when you make any changes.
- Ensure the backend is running on `:8080` or set `VITE_API_BASE_URL` for the frontend.
- If task names disappear when changing the deadline, make sure you are running the patched backend that performs partial updates correctly.
36 changes: 36 additions & 0 deletions backend/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"kanban": [
{
"id": "todo",
"title": "To Do"
},
{
"id": "inprogress",
"title": "In Progresswef"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There appears to be a typo in the title of this Kanban column.

Suggested change
"title": "In Progresswef"
"title": "In Progress"

},
{
"id": "done",
"title": "Done"
}
],
"tasks": [
{
"id": "20251119T215029.085279000",
"name": "",
"description": "",
"priority": "Medium",
"deadline": "",
"status_id": "todo",
"position": 0
Comment on lines +18 to +24

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This sample task has an empty name. The backend logic in InsertTask explicitly checks for and rejects tasks with empty names. This sample data is inconsistent with the API's validation rules and would be considered invalid if submitted through the API.

},
{
"id": "20251119T215155.147601000",
"name": "qwef",
"description": "qwefeef",
"priority": "Medium",
"deadline": "2025-11-19",
"status_id": "done",
"position": 0
}
]
}
Loading