This repository provides a curated collection of tasks, challenges, and projects designed to help upcoming backend engineers hone their skills and gain practical experience in backend development. Each task includes detailed instructions, database structures, model designs, and API endpoints to implement.
- Task 1: REST API for a Library Management System
- Task 2: News Aggregator API
- Task 3: Automated Email Notification System with Cron Jobs
- Task 4: Travel Agency API
- Task 5: URL Shortening Service
Build a RESTful API for a library management system that manages books, authors, and users. It should also handle borrowing and returning books, with additional features like role-based access control, search, and caching.
-
Environment
- Use a relational database (e.g., MySQL, PostgreSQL, SQLite).
-
Entities
- Book
id
: Integer, primary keyisbn
: String, required, uniquepublished_date
: Dateauthor_id
: Foreign key to Authorstatus
: Enum [Available, Borrowed], required
- Author
id
: Integer, primary keyname
: String, requiredbio
: Text, optionalbirthdate
: Date, optional
- User
id
: Integer, primary keyname
: String, requiredemail
: String, required, uniquepassword
: String, requiredrole
: Enum [Admin, Librarian, Member], required
- BorrowRecord
id
: Integer, primary keyuser_id
: Foreign key to Userbook_id
: Foreign key to Bookborrowed_at
: DateTime, requireddue_at
: DateTime, requiredreturned_at
: DateTime, optional
- Book
-
API Endpoints
- Books
GET /books
: Retrieve all books.GET /books/{id}
: Retrieve specific book by ID.POST /books
: Create a book (Admin/Librarian).PUT /books/{id}
: Update a book by ID (Admin/Librarian).DELETE /books/{id}
: Delete a book by ID (Admin).POST /books/{id}/borrow
: Borrow a book (Member, if available).POST /books/{id}/return
: Return a borrowed book (Member).
- Authors
- Similar CRUD operations for authors.
- Users
- Admin-only access to view and manage users.
POST /login
: Authenticate and return a JWT/sanctum token.
- BorrowRecords
- View borrow records (Admin/Librarian).
- Books
-
Additional Requirements
- Implement RBAC, search, pagination, validation, error handling, feature tests, and rate limiting.
Build a RESTful API for a news aggregator service that fetches articles from various sources and provides endpoints for a frontend application to consume.
-
User Authentication
- User registration and login with JWT/Sanctum.
- API token authentication and password reset.
-
Article Management
- Fetch articles with pagination, search/filter by keyword, date, category, and source.
-
User Preferences
- Allow users to set and retrieve preferences (news sources, categories, authors).
-
Data Aggregation
- Fetch articles from at least 3 APIs (e.g., NewsAPI, The Guardian, BBC News) and store locally.
-
API Documentation
- Provide documentation using Swagger/OpenAPI.
Build a system that allows users to schedule automated email notifications to be sent at a future date using cron jobs.
-
User Authentication
- Implement registration and login with sessions.
- Logged-in users can schedule email notifications.
-
Email Scheduling
- Allow users to schedule emails with recipient, subject, body, and send date/time.
- Use OOP principles (e.g.,
Email
class withscheduleEmail()
,sendEmail()
methods).
-
Cron Job
- Check for pending emails and send them at the scheduled time using SMTP.
- Implement retries for failed email attempts.
-
Database Design
- Tables:
users
,scheduled_emails
with fields like recipient_email, subject, body, scheduled_time, status, attempts.
- Tables:
-
Code Structure
- Use an MVC structure for organizing the code.
Develop a RESTful API for managing travels and tours. Users can browse public travels and book tours.
-
Models
- User
- Fields:
ID
,Email
,Password
- Fields:
- Roles (Many-to-Many with Users)
- Travels
- Fields:
ID
,IsPublic
,Slug
,Name
,Description
,NumberOfDays
- Fields:
- Tours
- Fields:
ID
,TravelID
,Name
,StartingDate
,EndingDate
,Price
- Fields:
- User
-
Endpoints
- Private (admin) endpoint for creating travels, tours, and users.
- Public endpoint for browsing travels and tours with filtering and sorting options.
-
Note
- Use UUIDs as primary keys if possible.
- Use integer values for tour prices (e.g., 99900 for €999.00).
Build a URL Shortener API that helps shorten long URLs.
- Models
- Url
- Fields:
ID
,original_url
,short_url
,created_at
,usage_count
- Fields:
- Url
- Basic Endpoint
-
POST
/shorten
- Request body
{ "originalUrl": "<longUrl>" }
- Response body
{ "shortUrl": "<shortUrl>" }
-
GET
/shorten/short_url
- Gets the base url and then redirects to the base url
-
GET `/stats/short_url
- Returns usage statistics for a given shortened URL (e.g., number of times accessed).
-