crystal-ecommerce

Projeto feito em Crystal - Kemal de um simples e-commerce.

Crystal E-Commerce (Kemal)

A lightweight e-commerce backend built with Crystal, Kemal and SQLite.

This project started from the e-commerce example available in the Kemal by Example repository and has been significantly extended to provide a richer backend suitable for framework migration benchmarks and architecture evaluation.

The goal of this repository is to serve as a realistic backend application for evaluating framework migrations (e.g. Kemal → Lucky) while preserving application behavior and business rules.


Original Reference

This project was originally based on:

https://github.com/sdogruyol/kemal-by-example

Specifically, the ecommerce example.

The original implementation has been extensively modified and expanded.


Technology Stack

  • Crystal
  • Kemal
  • SQLite
  • crystal-db
  • kemal-session

Features

Authentication

  • User registration
  • Login
  • Session-based authentication
  • Logout

Authorization

  • User roles
  • Administrator access (is_admin)
  • Protected administrative routes

Product Management

  • Product catalog
  • Product inventory
  • Product availability validation
  • Product creation (Admin only)
  • Product updates (Admin only)
  • Product deletion (Admin only)

Categories

  • Category model
  • Product categorization
  • Category filtering
  • Category listing

Shopping Cart

  • Add products
  • Remove products
  • Quantity updates
  • Cart persistence

Orders

  • Checkout flow
  • Order history
  • Order items

Search

  • Product search
  • Category filtering
  • Search combined with filters

Pagination

  • Product pagination
  • Public product listings show 8 products per page
  • Admin product listings show 10 products per page

Project Structure

src/
│
├── config/
├── helpers/
├── models/
├── routes/
└── views/

db/

Database

SQLite

Current entities:

  • Users
  • Products
  • Categories
  • CartItems
  • Orders
  • OrderItems

Business Rules

  • Authentication required for shopping features.
  • Only administrators can create, update, and delete products.
  • Products belong to a category.
  • Orders preserve purchased item information.
  • Product searches support category filtering.
  • Pagination is applied to product listings.

Running

Install dependencies:

shards install

Run:

crystal run src/ecommerce.cr

Open:

http://127.0.0.1:5000

Purpose

This repository is intended for:

  • Framework migration evaluation
  • Crystal ecosystem experimentation
  • Backend architecture comparison
  • AI coding model benchmarking

It intentionally contains multiple interacting backend features to create a migration task that requires understanding of routing, persistence, business rules, authentication and project organization rather than simple code translation.


License

This project is derived from the MIT licensed example available in the Kemal by Example repository.

Additional modifications and new features were implemented independently.

Repository

crystal-ecommerce

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 4
  • about 8 hours ago
  • July 9, 2026
License

Links
Synced at

Thu, 09 Jul 2026 22:29:46 GMT

Languages