-
Notifications
You must be signed in to change notification settings - Fork 1
Initial Commit #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
antongo10
wants to merge
1
commit into
sparklayer-io:main
Choose a base branch
from
antongo10:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }, | ||
| { | ||
| "id": "done", | ||
| "title": "Done" | ||
| } | ||
| ], | ||
| "tasks": [ | ||
| { | ||
| "id": "20251119T215029.085279000", | ||
| "name": "", | ||
| "description": "", | ||
| "priority": "Medium", | ||
| "deadline": "", | ||
| "status_id": "todo", | ||
| "position": 0 | ||
|
Comment on lines
+18
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }, | ||
| { | ||
| "id": "20251119T215155.147601000", | ||
| "name": "qwef", | ||
| "description": "qwefeef", | ||
| "priority": "Medium", | ||
| "deadline": "2025-11-19", | ||
| "status_id": "done", | ||
| "position": 0 | ||
| } | ||
| ] | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 forpytest, 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.