Skip to content

Ecomora Backend Server that use Ktor and Contains the Rest API for the desktop client Ecomora Store JVM Kotlin Multiplatform Project

Notifications You must be signed in to change notification settings

mwakuni/Ecomora_Server

Repository files navigation

Ecomora Server

Ecomora Server is a modern backend solution for ecommerce platforms, built with Kotlin and Ktor. It provides robust RESTful APIs to support scalable online store applications, with a secure, modular, and production-ready codebase.


Table of Contents


Introduction

Ecomora Server is designed to streamline backend ecommerce development. It leverages industry best-practices for security, validation, and database management using Ktor, Exposed ORM, HikariCP, and JWT authentication—all written in idiomatic Kotlin.

Technologies Used

Features

  • User authentication and robust JWT authorization
  • CRUD endpoints for users, categories, products, orders, carts, promotions, services, and more
  • Strong validation and error handling
  • Secure, production-ready JWT security with environment configuration
  • Modular structure and clean code separation (logging, validation, serialization, etc.)
  • PostgreSQL for production, H2 for development (auto-configured)
  • Highly configurable via environment variables
  • Development-ready API collection (Postman)
  • Extensible for new features and plugins

Installation

Clone the repository:

git clone https://github.com/your-username/ecomora-server.git
cd ecomora-server

Ensure you have JDK 17+ installed. Use the included Gradle wrapper:

./gradlew build

For Windows:

gradlew.bat build

Setup

  1. Set Environment Variables

    • Create a .env or add to your environment; required variables:
      • JWT_SECRET, JWT_AUDIENCE, JWT_DOMAIN, JWT_REALM
      • IS_PRODUCTION (true uses PostgreSQL, otherwise H2 embedded)
      • If using PostgreSQL: DB_URL, DB_USERNAME, DB_PASSWORD
      • (Optional) H2_PATH for custom H2 DB path
  2. Set up PostgreSQL for production:

    • Install PGAdmin4 or another Postgres client.
    • Create a new database.
    • Set JDBC connection variables as above in your run configuration.
  3. Start the server

    ./gradlew run
    # or: gradlew.bat run

Usage

  • Once running, the server listens on localhost:8080 by default.
  • Explore endpoints and test requests with the included Postman collection:
    EcomoraServer.postman_collection.json

Update your applications’ base URL as needed.


API Endpoints

Core endpoints (replace {id} as needed):

Users

  • Get all: GET /v1/users
  • Get single: GET /v1/users/{id}
  • Create: POST /v1/users
  • Login: GET /v1/login
  • Delete: DELETE /v1/users/{id}
  • Update: PUT /v1/users/{id}

Categories

  • Get all: GET /v1/categories
  • Get by ID: GET /v1/categories/{id}
  • Create: POST /v1/categories
  • Delete: DELETE /v1/categories/{id}
  • Update: PUT /v1/categories/{id}

Products

  • Get all: GET /v1/products
  • Get by ID: GET /v1/products/{id}
  • Create: POST /v1/products
  • Delete: DELETE /v1/products/{id}
  • Update: PUT /v1/products/{id}

Promotions

  • Get all: GET /v1/promotions
  • Get single: GET /v1/promotions/{id}
  • Create: POST /v1/promotions
  • Delete: DELETE /v1/promotions/{id}
  • Update: PUT /v1/promotions/{id}


Contributing

Contributions are welcome!

  • Please follow Kotlin idiomatic style.
  • Open issues or pull requests for bugs/features.

--

License

This project is licensed under the MIT License.


About

Ecomora is a feature-complete ecommerce server compatible with multiple frontend clients (including Kotlin Multiplatform).

About

Ecomora Backend Server that use Ktor and Contains the Rest API for the desktop client Ecomora Store JVM Kotlin Multiplatform Project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages