Skip to content

bharambetr2002/TaleTrail-Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

89 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š TaleTrail API

A clean, simple book tracking API built with .NET 8 and Supabase

.NET Supabase Docker License: MIT

TaleTrail is a modern book tracking API that allows users to manage their reading lists, write reviews, create blog posts, and track their reading progress. Built with simplicity and beginner-friendliness in mind.

✨ Features

  • πŸ” Authentication: Secure user registration and login with JWT
  • πŸ“– Book Management: Browse and search books with author and publisher information
  • πŸ“š Reading Lists: Track books with different statuses (ToRead, InProgress, Completed, Dropped)
  • ⭐ Reviews: Write and manage book reviews with ratings
  • πŸ“ Blog Posts: Create and share blog posts about books
  • πŸ‘€ User Profiles: Manage user profiles and public pages
  • πŸ₯ Health Checks: Built-in health monitoring
  • πŸ“Š Swagger Documentation: Interactive API documentation

πŸš€ Quick Start

Prerequisites

πŸƒβ€β™‚οΈ Running Locally

  1. Clone the repository

    git clone https://github.com/yourusername/taletrail-api.git
    cd taletrail-api
  2. Set up environment variables

    cp .env.example .env
    # Edit .env with your Supabase credentials
  3. Run the application

    cd TaleTrail.API
    dotnet restore
    dotnet run
  4. Open your browser

🐳 Running with Docker

  1. Using Docker Compose (Recommended)

    docker-compose up -d
  2. Using Docker directly

    docker build -t taletrail-api -f TaleTrail.API/Dockerfile .
    docker run -p 8080:8080 taletrail-api

πŸ“š API Documentation

Base URL

  • Development: http://localhost:5198
  • Production: https://your-render-app.onrender.com

πŸ”‘ Authentication Endpoints

Method Endpoint Description
POST /api/auth/signup Register new user
POST /api/auth/login Login user

πŸ“– Book Endpoints

Method Endpoint Description
GET /api/book Get all books (with search)
GET /api/book/{id} Get book by ID
GET /api/book/by-author/{authorId} Get books by author

πŸ“š User Book Endpoints (Protected)

Method Endpoint Description
GET /api/userbook/my-books Get user's books
POST /api/userbook Add book to user's list
PUT /api/userbook/{bookId} Update book status
DELETE /api/userbook/{bookId} Remove book from list

⭐ Review Endpoints

Method Endpoint Description
GET /api/review/book/{bookId} Get reviews for a book
POST /api/review Create review πŸ”’
PUT /api/review/{id} Update review πŸ”’
DELETE /api/review/{id} Delete review πŸ”’

πŸ“ Blog Endpoints

Method Endpoint Description
GET /api/blog Get all blogs
GET /api/blog/{id} Get blog by ID
POST /api/blog Create blog post πŸ”’
PUT /api/blog/{id} Update blog post πŸ”’
DELETE /api/blog/{id} Delete blog post πŸ”’

πŸ”’ = Requires authentication

For detailed API documentation, visit /swagger when the application is running.

πŸ—οΈ Architecture

TaleTrail.API/
β”œβ”€β”€ Controllers/         # API endpoints
β”œβ”€β”€ Services/           # Business logic
β”œβ”€β”€ DAO/               # Data access layer
β”œβ”€β”€ Model/             # Entity models and DTOs
β”œβ”€β”€ Middleware/        # Custom middleware
β”œβ”€β”€ Extensions/        # Extension methods
└── Data/             # Database seeding

πŸ”§ Configuration

Environment Variables

Variable Description Required
SUPABASE_URL Your Supabase project URL βœ…
SUPABASE_KEY Your Supabase anon key βœ…
SUPABASE_JWT_SECRET Your Supabase JWT secret βœ…
ALLOWED_ORIGINS CORS allowed origins ❌
ASPNETCORE_ENVIRONMENT Environment (Development/Production) ❌

Database Schema

The application uses the following main entities:

  • Users: User profiles and authentication
  • Books: Book information with authors and publishers
  • UserBooks: User's reading lists and progress
  • Reviews: Book reviews and ratings
  • Blogs: User blog posts
  • Authors: Book authors
  • Publishers: Book publishers

πŸš€ Deployment

Deploy to Render

  1. Push to GitHub: Ensure your code is in a GitHub repository
  2. Connect to Render: Link your GitHub repo to Render
  3. Set Environment Variables: Configure your Supabase credentials in Render
  4. Deploy: Render will automatically build and deploy using Docker

Deploy to Other Platforms

The application is containerized and can be deployed to:

  • Heroku: Using Docker
  • Railway: Using Docker
  • DigitalOcean App Platform: Using Docker
  • AWS ECS/Fargate: Using Docker
  • Google Cloud Run: Using Docker

πŸ§ͺ Testing

# Run all tests
dotnet test

# Run with coverage
dotnet test --collect:"XPlat Code Coverage"

🀝 Contributing

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ™ Acknowledgments

  • .NET Team for the amazing framework
  • Supabase for the backend infrastructure
  • Swagger for API documentation
  • Community contributors and supporters

Made with ❀️ for book lovers

# πŸ“š TaleTrail API

A clean, simple book tracking API built with .NET 8 and Supabase

.NET Supabase Docker License: MIT

TaleTrail is a modern book tracking API that allows users to manage their reading lists, write reviews, create blog posts, and track their reading progress. Built with simplicity and beginner-friendliness in mind.

✨ Features

  • πŸ” Authentication: Secure user registration and login with JWT
  • πŸ“– Book Management: Browse and search books with author and publisher information
  • πŸ“š Reading Lists: Track books with different statuses (ToRead, InProgress, Completed, Dropped)
  • ⭐ Reviews: Write and manage book reviews with ratings
  • πŸ“ Blog Posts: Create and share blog posts about books
  • πŸ‘€ User Profiles: Manage user profiles and public pages
  • πŸ₯ Health Checks: Built-in health monitoring
  • πŸ“Š Swagger Documentation: Interactive API documentation

πŸš€ Quick Start

Prerequisites

πŸƒβ€β™‚οΈ Running Locally

  1. Clone the repository

    git clone https://github.com/yourusername/taletrail-api.git
    cd taletrail-api
  2. Set up environment variables

    cp .env.example .env
    # Edit .env with your Supabase credentials
  3. Run the application

    cd TaleTrail.API
    dotnet restore
    dotnet run
  4. Open your browser

🐳 Running with Docker

  1. Using Docker Compose (Recommended)

    docker-compose up -d
  2. Using Docker directly

    docker build -t taletrail-api -f TaleTrail.API/Dockerfile .
    docker run -p 8080:8080 taletrail-api

πŸ“š API Documentation

Base URL

  • Development: http://localhost:5198
  • Production: https://your-render-app.onrender.com

πŸ”‘ Authentication Endpoints

Method Endpoint Description
POST /api/auth/signup Register new user
POST /api/auth/login Login user

πŸ“– Book Endpoints

Method Endpoint Description
GET /api/book Get all books (with search)
GET /api/book/{id} Get book by ID
GET /api/book/by-author/{authorId} Get books by author

πŸ“š User Book Endpoints (Protected)

Method Endpoint Description
GET /api/userbook/my-books Get user's books
POST /api/userbook Add book to user's list
PUT /api/userbook/{bookId} Update book status
DELETE /api/userbook/{bookId} Remove book from list

⭐ Review Endpoints

Method Endpoint Description
GET /api/review/book/{bookId} Get reviews for a book
POST /api/review Create review πŸ”’
PUT /api/review/{id} Update review πŸ”’
DELETE /api/review/{id} Delete review πŸ”’

πŸ“ Blog Endpoints

Method Endpoint Description
GET /api/blog Get all blogs
GET /api/blog/{id} Get blog by ID
POST /api/blog Create blog post πŸ”’
PUT /api/blog/{id} Update blog post πŸ”’
DELETE /api/blog/{id} Delete blog post πŸ”’

πŸ”’ = Requires authentication

For detailed API documentation, visit /swagger when the application is running.

πŸ—οΈ Architecture

TaleTrail.API/
β”œβ”€β”€ Controllers/         # API endpoints
β”œβ”€β”€ Services/           # Business logic
β”œβ”€β”€ DAO/               # Data access layer
β”œβ”€β”€ Model/             # Entity models and DTOs
β”œβ”€β”€ Middleware/        # Custom middleware
β”œβ”€β”€ Extensions/        # Extension methods
└── Data/             # Database seeding

πŸ”§ Configuration

Environment Variables

Variable Description Required
SUPABASE_URL Your Supabase project URL βœ…
SUPABASE_KEY Your Supabase anon key βœ…
SUPABASE_JWT_SECRET Your Supabase JWT secret βœ…
ALLOWED_ORIGINS CORS allowed origins ❌
ASPNETCORE_ENVIRONMENT Environment (Development/Production) ❌

Database Schema

The application uses the following main entities:

  • Users: User profiles and authentication
  • Books: Book information with authors and publishers
  • UserBooks: User's reading lists and progress
  • Reviews: Book reviews and ratings
  • Blogs: User blog posts
  • Authors: Book authors
  • Publishers: Book publishers

πŸš€ Deployment

Deploy to Render

  1. Push to GitHub: Ensure your code is in a GitHub repository
  2. Connect to Render: Link your GitHub repo to Render
  3. Set Environment Variables: Configure your Supabase credentials in Render
  4. Deploy: Render will automatically build and deploy using Docker

Deploy to Other Platforms

The application is containerized and can be deployed to:

  • Heroku: Using Docker
  • Railway: Using Docker
  • DigitalOcean App Platform: Using Docker
  • AWS ECS/Fargate: Using Docker
  • Google Cloud Run: Using Docker

πŸ§ͺ Testing

# Run all tests
dotnet test

# Run with coverage
dotnet test --collect:"XPlat Code Coverage"

🀝 Contributing

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ™ Acknowledgments

  • .NET Team for the amazing framework
  • Supabase for the backend infrastructure
  • Swagger for API documentation
  • Community contributors and supporters

Made with ❀️ for book lovers

About

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors