A Rails 8.1 API backend for NativeAppTemplate iOS/Android mobile applications. It's a multi-tenant SaaS application with token-based authentication, role-based authorization, and RESTful API endpoints.
Extracted from the Rails API backend for MyTurnTag Creator for iOS and MyTurnTag Creator for Android.
For more information, visit nativeapptemplate.com.
- Ruby on Rails 8.1
- PostgreSQL
- Solid Queue/Cable/Cache
- devise_token_auth
- jsonapi-serializer
- pundit
- acts_as_tenant
- pagy
- Turbo (real-time page updates for Number Tags Webpage)
- Test (Minitest)
- Sign Up / Sign In / Sign Out
- Email Confirmation
- Forgot Password
- CRUD Operations for Shops (Create/Read/Update/Delete)
- CRUD Operations for Shops' Nested Resource, Number Tags (ItemTags) (Create/Read/Update/Delete)
- URL Path-Based Multitenancy (prepends
/:account_id/to URLs) - User Invitation to Organizations
- Role-Based Permissions and Access Control
- Organization Switching UI
- Admin Panel
- Force App Version Update
- Force Privacy Policy Version Update
- Force Terms of Use Version Update
- And more!
You'll need the following installed to run the template successfully:
- Ruby 4.0.2+
- PostgreSQL 16+
- Libvips -
brew install vips - Overmind -
brew install tmux overmind- helps run all your processes in development
If you use Homebrew, dependencies are listed in Brewfile so you can install them using:
brew bundle install --no-upgradeThen you can start the database servers:
brew services start postgresqlFirst, edit config/database.yml and change the database credentials for your server.
Run bin/setup to install Ruby and JavaScript dependencies and setup your database and seed initial data to the database.
bin/setupCopy .env.sample to .env and set HOST to your current Wi-Fi IP. On macOS: ipconfig getifaddr en0. bin/dev binds Rails to that address so the dev server is reachable from both the host browser and from any phone on the same network at http://<wifi-ip>:3000. When your Wi-Fi IP changes, update HOST here and the matching NATEMPLATE_API_DOMAIN in the mobile apps (Xcode scheme for iOS, ~/.gradle/gradle.properties for Android) — Rails fails loudly if HOST is unset, which keeps the three sides honest. Never use 127.0.0.1, localhost, or 0.0.0.0.
To run your application, you'll use the bin/dev command:
bin/devThis starts up Overmind running the processes defined in Procfile.dev. We've configured this to run the Rails server out of the box.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on reporting issues, proposing changes, and submitting pull requests.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
If you discover a security vulnerability, please follow the disclosure process in SECURITY.md. Do not open public issues for security concerns.
This project is licensed under the MIT License — see LICENSE for details.