This is the Rails API for CommuneXR, a community platform connecting neighbors through skill sharing.
🔗 Base URL: https://communexr.onrender.com
Watch the full demo of CommuneXR in action:
🔗 https://youtu.be/DE8ptjoFxhw
| Interactive Map | Create Service |
|---|---|
![]() |
![]() |
| Dashboard | Service Details |
|---|---|
![]() |
![]() |
- Ruby on Rails 7 (API mode)
- PostgreSQL
- Devise for authentication
- Geocoder for location services
- Deployed on Render
| Method | Endpoint | Description |
|---|---|---|
| GET | /services |
List all services |
| GET | /services/:id |
Get service details |
| POST | /services |
Create a new service |
| POST | /exchanges |
Create an exchange |
| PATCH | /exchanges/:id |
Update exchange status |
| GET | /users/:id |
Get user profile |
| GET | /users/:id/exchanges |
Get user exchanges |
Service
├── service_type :offer or :need
├── status :open / :in_progress / :closed
├── latitude & longitude
└── belongs_to :User
Exchange
├── belongs_to :service
├── belongs_to :helper (User)
├── belongs_to :requester (User)
├── status :proposed / :accepted / :completed / :rejected
└── message :text
User
├── has_many :services
├── has_many :helped_exchanges
├── has_many :requested_exchanges
├── has_many :badges through: :user_badges
└── points :integer
🎮 Gamification Logic
ruby
# Automatic badge attribution
after_update :check_badges, if: :completed?
def check_badges
# First exchange → "First Helper" badge
if helper.helped_exchanges.completed.count == 1
helper.badges << Badge.find_by(name: "First Helper")
end
# 5 exchanges → "Good Neighbor" badge
if helper.helped_exchanges.completed.count == 5
helper.badges << Badge.find_by(name: "Good Neighbor")
end
# +10 points per completed exchange
helper.increment!(:points, 10)
end
🚦 Getting Started
Prerequisites
Ruby 3.2+
PostgreSQL
Bundler
Installation
bash
# Clone the repository
git clone https://github.com/joupify/communeXR.git
cd communeXR
# Install dependencies
bundle install
# Setup database
rails db:create db:migrate db:seed
# Start Rails server
rails s -p 3000
The API will be available at http://localhost:3000
🔗 Frontend Repository
👉 https://github.com/joupify/communeXR_front
🧪 Running Tests
bash
rails test
📁 Project Structure
text
communeXR/
├── app/
│ ├── controllers/ # API endpoints
│ ├── models/ # Business logic
│ └── serializers/ # JSON formatting
├── config/ # Configuration files
├── db/ # Migrations and seeds
└── test/ # Test suite
🚀 Deployment
This API is deployed on Render.com.
Environment variables needed:
text
DATABASE_URL=postgresql://...
RAILS_MASTER_KEY=your_master_key
FRONTEND_URL=https://communexr-front.onrender.com
🤝 Contributing
Contributions, issues and feature requests are welcome!
📝 License
MIT © joupify
Built with ❤️ for the DEV Weekend Challenge



