Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GEM
bcrypt_pbkdf (1.1.2)
bigdecimal (4.1.2)
bindex (0.8.1)
bootsnap (1.24.3)
bootsnap (1.24.5)
msgpack (~> 1.2)
brakeman (8.0.4)
racc
Expand Down Expand Up @@ -523,9 +523,10 @@ CHECKSUMS
bcrypt_pbkdf (1.1.2) sha256=c2414c23ce66869b3eb9f643d6a3374d8322dfb5078125c82792304c10b94cf6
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e
bootsnap (1.24.3) sha256=f7fa3d20597e2f0aa52b0a1aba83fb54d4f79e9c2e210ec4fa1e8895514dcad8
bootsnap (1.24.5) sha256=36b677448524d279b470469aabd5dff4a980e3fa4931a0df68da4a500eb1b6c4
brakeman (8.0.4) sha256=7bf921fa9638544835df9aa7b3e720a9a72c0267f34f92135955edd80d4dcf6f
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
bundler (4.0.12) sha256=7f8b757d28dfb636e7b24fba2344ac6dd13b5b24f4b46d62573d483f211825ac
bundler-audit (0.9.3) sha256=81c8766c71e47d0d28a0f98c7eed028539f21a6ea3cd8f685eb6f42333c9b4e9
capybara (3.40.0) sha256=42dba720578ea1ca65fd7a41d163dd368502c191804558f6e0f71b391054aeef
childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec
Expand Down
141 changes: 128 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,139 @@
# README
# Tokko — Rails E-Commerce Starter Kit

This README would normally document whatever steps are necessary to get the
application up and running.
A production-ready e-commerce starter kit built with Rails 8.1. Ships with everything you need to launch an online store: products with variants, Stripe checkout, customer accounts, discount coupons, inventory tracking, and a full-featured admin dashboard.

Things you may want to cover:
## Features

* Ruby version
**Storefront**
- Product catalog with variants, options, and faceted filtering
- Category and collection pages
- Full-text product search
- Cart and Stripe Checkout (with coupon support)
- Customer accounts — order history, saved addresses, wishlist
- Magic link authentication (no password required)
- SEO-ready — meta tags, Open Graph, slug-based URLs with redirect history

* System dependencies
**Dashboard**
- Product management — create products, generate variants from options (Size × Color)
- Inventory tracking with movement history
- Order management with status flow (`pending → paid → shipped → completed`)
- Coupon/discount codes — percentage or fixed, with expiry and usage limits
- Collections and categories management
- User roles — Owner, Admin, Staff

* Configuration
**Technical**
- Rails 8.1, PostgreSQL, Hotwire (Turbo + Stimulus), Tailwind CSS
- Stripe Checkout + webhook handling
- Background jobs via Solid Queue, caching via Solid Cache
- FriendlyId slug URLs with history (301 redirects when slugs change)
- N+1 protection via Prosopite in development and test
- RSpec test suite

* Database creation
## Requirements

* Database initialization
- Ruby 4.0+
- PostgreSQL 14+
- Node.js (for Tailwind CSS watcher)
- A [Stripe](https://stripe.com) account

* How to run the test suite
## Quick Start

* Services (job queues, cache servers, search engines, etc.)
```bash
git clone <your-repo-url> my-store
cd my-store
bin/setup
```

* Deployment instructions
`bin/setup` installs dependencies, creates and seeds the database, and starts the server at `http://localhost:3000`.

* ...
To reset the database and start fresh:

```bash
bin/setup --reset
```

## Configuration

All secrets are managed via Rails credentials. Open the credentials file:

```bash
bin/rails credentials:edit
```

Add the following:

```yaml
stripe:
secret_key: sk_test_...
webhook_secret: whsec_...

smtp:
user_name: your@email.com
password: your-smtp-password
```

**Stripe webhook** — in development, use the Stripe CLI to forward events:

```bash
stripe listen --forward-to localhost:3000/webhooks/stripe
```

Copy the webhook signing secret it prints and add it to credentials as `stripe.webhook_secret`.

## Development

```bash
bin/dev # Start server + Tailwind watcher (port 3000)
```

**Default admin account** (created by seed):

```
Email: admin@tokko.com
Password: password
```

Log in at `http://localhost:3000/dashboard`.

## Testing

```bash
bundle exec rspec # Full suite
bundle exec rspec spec/models/product_spec.rb # Single file
```

**Code quality:**

```bash
bin/rubocop # Linting
bin/brakeman # Security audit
bin/bundler-audit # Gem vulnerability check
```

## Deployment

This project includes a [Kamal](https://kamal-deploy.org) configuration. Update `config/deploy.yml` with your server IP and image registry, then:

```bash
kamal setup # First deploy
kamal deploy # Subsequent deploys
```

Set `RAILS_MASTER_KEY` on your server (found in `config/master.key`):

```bash
kamal env push
```

## Roadmap

- [ ] Role-based authorization (Pundit)
- [ ] Audit log for admin actions (PaperTrail)
- [ ] Store settings (name, logo, currency)
- [ ] Custom error pages (404, 500)
- [ ] Product reviews
- [ ] Shipping rate configuration

## License

MIT
Loading