task-tracker-svelte Svelte Themes

Task Tracker Svelte

Task and Time Tracking App

A full-stack productivity application built with SvelteKit that allows users to manage tasks, track time with a real-time timer, and view daily productivity summaries.

โœจ Features

  • Secure Authentication: Sign up, log in, and log out with session-based cookies
  • Task Management: Create, edit, update status (Pending, In Progress, Completed), and delete tasks
  • Real-Time Timer: Start/stop time tracking with live elapsed time display
  • Daily Summary: View today's tracked time, completed tasks, in-progress tasks, and pending tasks
  • Mock In-Memory Database: All data stored in-memory during development session
  • Beautiful UI: Modern, responsive design with gradients, glassmorphism, and smooth animations
  • RESTful API: Clean backend API with proper authorization and validation

๐Ÿ“ Folder Structure

task-tracker-app/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ routes/ โ”‚ โ”‚ โ”œโ”€โ”€ api/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ auth/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ login/+server.ts โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ logout/+server.ts โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ signup/+server.ts โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ tasks/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ +server.ts โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [id]/ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ +server.ts โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ time-logs/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ +server.ts โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [id]/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ +server.ts โ”‚ โ”‚ โ”œโ”€โ”€ dashboard/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ +page.svelte โ”‚ โ”‚ โ”œโ”€โ”€ login/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ +page.svelte โ”‚ โ”‚ โ”œโ”€โ”€ signup/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ +page.svelte โ”‚ โ”‚ โ””โ”€โ”€ +page.svelte โ”‚ โ”œโ”€โ”€ lib/ โ”‚ โ”‚ โ”œโ”€โ”€ mockdb.ts โ”‚ โ”‚ โ”œโ”€โ”€ auth.ts โ”‚ โ”‚ โ””โ”€โ”€ stores.ts โ”‚ โ””โ”€โ”€ app.html โ”œโ”€โ”€ static/ โ”œโ”€โ”€ package.json โ”œโ”€โ”€ svelte.config.js โ”œโ”€โ”€ vite.config.ts โ””โ”€โ”€ README.md ๐Ÿš€ Tech Stack


  • Frontend: SvelteKit, Tailwind CSS
  • Backend: SvelteKit Server Routes (mock in-memory database)
  • Authentication: Session-based cookies with in-memory session store
  • Styling: Tailwind CSS with custom gradients and animations
  • Deployment: Vercel (static site with serverless functions)

๐ŸŒ Live Demo

Live Demo

๐Ÿ› ๏ธ Local Development

Prerequisites

  • Node.js (v18 or higher)
  • npm or pnpm

Installation

# Clone the repository
git clone https://github.com/your-username/task-tracker-app.git
cd task-tracker-app

# Install dependencies
npm install

# Start development server
npm run dev
The application runs on `http://localhost:5173` by default.

๐Ÿงช Test Credentials
-------------------

For quick testing, use these credentials:

-   Email: `[email protected]`
-   Password: `password123`


> Note: Since this uses an in-memory database, all data resets when the server restarts. This is acceptable for demonstration purposes.

๐Ÿ”’ Authentication Flow
----------------------

1.  Signup: Users can create an account with email and password
2.  Login: Users authenticate with credentials and receive a session cookie
3.  Session Management: All protected routes validate the session cookie
4.  Logout: Session is destroyed and user is redirected to login page

All authentication is handled server-side with proper validation and error handling.

๐Ÿ“Š Task & Time Tracking
-----------------------

### Task Management

-   Create tasks with title and description
-   Update task status between three states:
    -   `Pending` (default state)
    -   `In Progress` (when timer is active)
    -   `Completed` (when task is finished)
-   Delete tasks (removes associated time logs)

### Time Tracking

-   Start Timer: Begins tracking time for a task and sets status to "In Progress"
-   Stop Timer: Saves time log to database and automatically marks task as "Completed"
-   Real-time Display: Timer updates every second with live elapsed time
-   Persistence: Time logs are stored and displayed in daily summaries

### Daily Summary

The dashboard displays real-time metrics:

-   Today's Time: Total time tracked today (including active timer)
-   Completed Today: Number of tasks completed today
-   In Progress: Tasks currently being worked on
-   Pending: Tasks waiting to be started

All metrics update automatically when tasks or time logs change.

๐Ÿ—„๏ธ Mock Database Implementation
--------------------------------

The application uses a mock in-memory database stored in `src/lib/mockdb.ts`:

ts

export const db = {
  users: [...],
  tasks: [...],
  timeLogs: [...],
  sessions: {}
};

This approach:

-   โœ… Eliminates need for external database setup
-   โœ… Keeps the assignment self-contained
-   โœ… Demonstrates full CRUD functionality
-   โš ๏ธ Note: Data resets when server restarts (expected behavior for demo)

๐ŸŽจ UI/UX Design
---------------

The application features a modern, professional design with:

-   Gradient Headers: Beautiful color transitions for visual appeal
-   Glassmorphism Cards: Semi-transparent backgrounds with blur effect
-   Status Indicators: Color-coded dots and badges for task status
-   Responsive Layout: Works on mobile, tablet, and desktop
-   Interactive Elements: Hover effects, smooth transitions, and feedback
-   Real-time Updates: All data updates instantly without page refresh

๐Ÿงช API Endpoints
----------------

### Authentication

-   `POST /api/auth/signup` - Create new user account
-   `POST /api/auth/login` - Authenticate user and create session
-   `POST /api/auth/logout` - Destroy user session

### Tasks

-   `GET /api/tasks` - Get all user tasks
-   `POST /api/tasks` - Create new task
-   `PATCH /api/tasks/:id` - Update task status
-   `DELETE /api/tasks/:id` - Delete task and associated time logs

### Time Logs

-   `GET /api/time-logs` - Get all user time logs
-   `POST /api/time-logs` - Create new time log entry

All endpoints include:

-   โœ… User authorization checks
-   โœ… Input validation
-   โœ… Proper HTTP status codes
-   โœ… Error handling

๐Ÿš€ Deployment
-------------

Deployed on Vercel with the following configuration:

-   Build Command: `npm run build`
-   Publish Directory: `build/`
-   Environment: Production-ready SvelteKit app

The application is fully functional in production with the same mock database behavior.


๐Ÿค Contributing
---------------

This is a solo assignment project. No external contributions are expected.

๐Ÿ“„ License
----------

This project is for educational and demonstration purposes only.

* * * * *

Built with โค๏ธ using SvelteKit

Top categories

Loading Svelte Themes