Skip to content

Carlolis/car-sharing-back

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

259 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Car Sharing Backend

This project is a Scala 3 application using PostgreSQL for database management and Bleep for build automation.

Prerequisites

  • Scala 3
  • PostgreSQL
  • Bleep

Setup

Install PostgreSQL

Install PostgreSQL on your system and create a database:

createdb car

Install Bleep

Follow the Bleep installation guide to install Bleep on your system.

Configuration

  1. PostgreSQL Configuration:

    Ensure that PostgreSQL is running and properly configured. Set the following environment variables:

    export DATABASE_URL="jdbc:postgresql://localhost:5432/car"
    export DATABASE_USER="myuser"
    export DATABASE_PASSWORD="mypassword"
  2. Application Configuration:

    The application uses ZIO Config to load configuration from application.conf.

    To set up your configuration:

    • Copy the example configuration file:

      cp domain/src/resources/application.conf.example domain/src/resources/application.conf
    • Edit the application.conf file with your settings:

      • WebDAV/NextCloud connection settings (username, password, URL)
      • Authentication settings (secret key, token expiration)
    • For production, you can set environment variables instead:

      • NEXTCLOUD_USERNAME - Your NextCloud username
      • NEXTCLOUD_PASSWORD - Your NextCloud password
      • NEXTCLOUD_URL - Your NextCloud URL
      • NEXTCLOUD_BASE_PATH - Base path for files (default: "voiture")
      • AUTH_SECRET_KEY - Secret key for JWT token generation
      • AUTH_TOKEN_EXPIRATION_SECONDS - Token expiration time in seconds

    Note: The application.conf file is excluded from version control to prevent committing sensitive data.

  3. Bleep Configuration:

    Initialize Bleep in your project directory:

    bleep new

Usage

Compile the Project

To compile the project, run:

bleep compile web

Run the Project

To run the project, use:

bleep run web

Test the Project

To execute tests, run:

bleep test repository-test-postgres

Project Structure

  • domain/: Core business logic, models, service traits
  • repository-postgres/: PostgreSQL persistence using Doobie + Flyway
  • remote-storage/: WebDAV/NextCloud file storage
  • web/: HTTP API layer using Tapir
  • bleep.yaml: Bleep build configuration file

Database Migrations

This project uses Flyway for database migrations. Migration files are located in repository-postgres/src/resources/db/migration/.

Migrations are automatically applied on application startup.

Additional Resources

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors