Skip to content

yahongie2014/Astudio-Task-Assessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Technical Assessment - AStudio

A full-stack project management and timesheet tracking application built with Laravel (Backend) and React (Frontend).

πŸ“‹ View Original Task Requirements


πŸ“‘ Table of Contents


✨ Features

Backend (Laravel API)

  • πŸ” Authentication System - JWT-based auth using Laravel Sanctum
  • πŸ‘₯ User Management - CRUD operations for users
  • πŸ“Š Project Management - Create, update, and track projects
  • ⏱️ Timesheet Tracking - Log hours worked on projects
  • πŸ” Advanced Filtering - Filter by date, status, department, etc.
  • πŸ“„ Pagination - Efficient data loading
  • βœ… Form Validation - Comprehensive request validation
  • 🎨 API Resources - Clean, structured JSON responses

Frontend (React + Vite)

  • 🎯 Modern UI - Built with Bootstrap 5
  • πŸ“± Responsive Design - Mobile-friendly interface
  • πŸ”Ž Real-time Search - Debounced search functionality
  • πŸŽ›οΈ Dynamic Filters - Filter by multiple criteria
  • πŸ“„ Smart Pagination - Navigate large datasets easily
  • ⚑ Performance Optimized - Fast loading with React Query
  • 🎨 Custom Components - Reusable UI components
  • πŸ›‘οΈ Error Boundary - Graceful error handling

πŸ› οΈ Tech Stack

Backend

  • Framework: Laravel 11.x
  • Authentication: Laravel Sanctum
  • Database: MySQL
  • PHP Version: 8.2+

Frontend

  • Framework: React 18
  • Build Tool: Vite
  • Styling: Bootstrap 5
  • State Management: React Context API
  • HTTP Client: Axios
  • Routing: React Router v6

πŸ“‚ Project Structure

astudio-assessment/
β”œβ”€β”€ Backend/              # Laravel API
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ Http/
β”‚   β”‚   β”‚   β”œβ”€β”€ Controllers/
β”‚   β”‚   β”‚   β”‚   └── API/
β”‚   β”‚   β”‚   β”œβ”€β”€ Requests/
β”‚   β”‚   β”‚   └── Resources/
β”‚   β”‚   └── Models/
β”‚   β”œβ”€β”€ database/
β”‚   β”‚   └── migrations/
β”‚   └── routes/
β”‚       └── api.php
β”‚
β”œβ”€β”€ FrontEnd/            # React Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ Components/
β”‚   β”‚   β”‚   β”œβ”€β”€ DataTable/
β”‚   β”‚   β”‚   β”œβ”€β”€ Filters/
β”‚   β”‚   β”‚   β”œβ”€β”€ Pagination/
β”‚   β”‚   β”‚   └── TopNav/
β”‚   β”‚   β”œβ”€β”€ Context/
β”‚   β”‚   β”œβ”€β”€ Pages/
β”‚   β”‚   └── styles/
β”‚   └── vite.config.js
β”‚
└── Docs/               # Documentation
    β”œβ”€β”€ astudio.sql
    └── Erd.png

πŸ”§ Backend Setup

Prerequisites

  • PHP 8.2 or higher
  • Composer
  • MySQL 5.7+

Installation Steps

  1. Navigate to Backend directory
cd Backend
  1. Install Dependencies
composer install
  1. Environment Configuration
cp .env.example .env
  1. Configure Database Edit .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=astudio
DB_USERNAME=your_username
DB_PASSWORD=your_password
  1. Generate Application Key
php artisan key:generate
  1. Run Migrations
php artisan migrate
  1. Seed Database (Optional)
php artisan db:seed
  1. Start Development Server
php artisan serve

The API will be available at http://localhost:8000

Available Artisan Commands

# Clear all caches
php artisan optimize:clear

# List all routes
php artisan route:list

# Generate API documentation
php artisan route:list --json

πŸ’» Frontend Setup

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation Steps

  1. Navigate to Frontend directory
cd FrontEnd
  1. Install Dependencies
npm install
  1. Environment Configuration
cp .env.example .env

Edit .env:

VITE_API_BASE=http://localhost:8000/api
  1. Start Development Server
npm run dev

The app will be available at http://localhost:5173

Build for Production

npm run build

πŸ“š API Documentation

Base URL

  • Local: http://localhost:8000/api
  • Production: https://astudio-task-assessment-production.up.railway.app/api

Authentication Endpoints

Register

POST /api/register
Content-Type: application/json

{
  "name": "johndoe",
  "first_name": "John",
  "last_name": "Doe",
  "dob": "1990-01-01",
  "gender": "male",
  "email": "[email protected]",
  "password": "password123",
  "password_confirmation": "password123"
}

Login

POST /api/login
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "password123"
}

Logout

POST /api/logout
Authorization: Bearer {token}

Resource Endpoints

All endpoints below require authentication (Authorization: Bearer {token})

Users

  • GET /api/users - List all users
  • GET /api/users/{id} - Get user details
  • POST /api/users - Create new user
  • POST /api/users/update - Update user
  • POST /api/users/delete - Delete user

Projects

  • GET /api/projects - List all projects
  • GET /api/projects/{id} - Get project details
  • POST /api/projects - Create new project
  • POST /api/projects/update - Update project
  • POST /api/projects/delete - Delete project

Timesheets

  • GET /api/timesheets - List all timesheets
  • GET /api/timesheets/{id} - Get timesheet details
  • POST /api/timesheets - Create new timesheet
  • POST /api/timesheets/update - Update timesheet
  • POST /api/timesheets/delete - Delete timesheet

Example Requests

Create Project:

POST /api/projects
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "Mobile App Redesign",
  "department": "IT",
  "start_date": "2025-01-01",
  "end_date": "2025-06-30",
  "status": "active"
}

Create Timesheet:

POST /api/timesheets
Authorization: Bearer {token}
Content-Type: application/json

{
  "user_id": 1,
  "project_id": 1,
  "task_name": "Frontend Development",
  "date": "2025-10-11",
  "hours": 8.5
}

Full API Documentation

πŸ“– View Complete Postman Documentation


πŸ—„οΈ Database Schema

Tables Overview

users

  • id, name, first_name, last_name, dob, gender, email, password
  • Relationships: hasMany timesheets, belongsToMany projects

projects

  • id, name, department, start_date, end_date, status
  • Relationships: hasMany timesheets, belongsToMany users

time_sheets

  • id, user_id, project_id, task_name, date, hours
  • Relationships: belongsTo user, belongsTo project

project_user (Pivot Table)

  • id, user_id, project_id

Entity Relationship Diagram

Database ERD


🌐 Live Demo

Deployed Applications

Backend API

Frontend Application

Demo Credentials

Email: [email protected]
Password: password123

πŸ“Έ Screenshots

Data Table Interface

Data Table


πŸ§ͺ Testing

Backend Tests

cd Backend
php artisan test

Frontend Tests

cd FrontEnd
npm run test

πŸ” Security Features

  • βœ… Password hashing with bcrypt
  • βœ… CSRF protection
  • βœ… SQL injection prevention via Eloquent ORM
  • βœ… XSS protection
  • βœ… Rate limiting on API endpoints
  • βœ… Token-based authentication
  • βœ… Input validation and sanitization

πŸš€ Deployment

Backend (Railway/Heroku)

  1. Set environment variables
  2. Configure database connection
  3. Run migrations: php artisan migrate --force
  4. Deploy via Git hook

Frontend (Vercel/Netlify)

  1. Connect GitHub repository
  2. Set build command: npm run build
  3. Set output directory: dist
  4. Configure environment variables
  5. Deploy automatically on push

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is part of a technical assessment and is for demonstration purposes.


πŸ‘¨β€πŸ’» Author

Ahmed Saeed


πŸ™ Acknowledgments

  • Laravel Community
  • React Community
  • AStudio for the opportunity
  • All contributors and supporters

⭐ If you find this project useful, please consider giving it a star!

Made with ❀️ by Ahmed Saeed