Technology Stack for AI-Powered Coworking Space
Overview
This document outlines the complete technology stack for building and operating your AI-powered coworking space, from smart locks to member portal to AI systems.
Philosophy: Start simple, automate incrementally, build vs. buy where your skills allow.
1. Smart Access Control
Smart Lock System
Recommended: Latch (Commercial Grade)
- Why: Built for commercial/multifamily, robust API, good support
- Cost: ~$400-600 per door + $10-20/month per lock
- Features: Bluetooth unlock, app access, access codes, audit trail, API for integration
- API: RESTful, webhooks for events
- Alternatives:
- 2-3 locks (main entrance, possibly individual unit doors)
- Latch Manager account
- WiFi bridge/hub for connectivity
- August Pro (cheaper, ~$250, but more consumer-grade)
- Yale Assure Lock (good middle ground, ~$300)
- Schlage Encode Plus (Apple Home support, ~$350)
What You Need:
Integration Plan:
Your Rails app
class AccessControlService
def grant_access(member, start_time, end_time)
# Call Latch API to create access code
# Or grant Bluetooth access via mobile app
end def revoke_access(member)
# Remove access when membership expires
end
def log_entry(event)
# Webhook from Latch when door unlocked
# Track who entered when
end
end
Access Control Flow
1. Member signs up → Stripe subscription created
2. Your system creates Latch user + grants access
3. Member gets email with app download link
4. Member uses phone to unlock door (Bluetooth or app-based unlock)
5. Entry logged in your dashboard
6. Member cancels → Access automatically revoked
2. Member Portal & Management
Backend: Ruby on Rails
Why Rails?
Core Models:
app/models/
User (Devise for auth)
Membership (subscription tiers, status)
Booking (desk/room reservations)
AccessLog (entry/exit tracking)
Event (community events)
Invoice (Stripe integration)
Feedback (member surveys, NPS)
Key Features:
Frontend: Hotwire (Turbo + Stimulus)
Why Hotwire?
Key Views:
Real-time Features:
Turbo Streams for live updates
When someone books a room, all users see availability update
class BookingsController < ApplicationController
def create
@booking = current_user.bookings.create(booking_params) respond_to do |format|
format.turbo_stream # Updates availability in real-time
format.html
end
end
end
Mobile: Progressive Web App (PWA)
Why PWA vs Native?
Key Mobile Features:
Tech:
3. AI & Automation
AI Chatbot: Member Support
LLM Provider: Claude (via Anthropic API)
- "How do I book a meeting room?"
- "What are your hours?"
- "Coffee machine isn't working" → Creates issue ticket
- "Find me a quiet desk for 2 hours this afternoon"
Implementation:
app/services/ai_concierge_service.rb
class AiConciergeService
def initialize(member)
@member = member
@client = Anthropic::Client.new(api_key: ENV['ANTHROPIC_API_KEY'])
end def chat(message)
context = build_context # member info, current bookings, space availability
response = @client.messages(
model: "claude-3-5-sonnet-20241022",
messages: [
{ role: "user", content: message }
],
system: ai_system_prompt(context),
tools: available_tools # booking, issue reporting, etc.
)
handle_tool_calls(response) if response.tool_calls?
response.content
end
private
def available_tools
[
{
name: "book_room",
description: "Book a meeting room for the member",
input_schema: {
type: "object",
properties: {
room_id: { type: "string" },
start_time: { type: "string" },
duration_hours: { type: "number" }
}
}
},
{
name: "report_issue",
description: "Create a maintenance or issue ticket",
input_schema: {
type: "object",
properties: {
description: { type: "string" },
priority: { type: "string", enum: ["low", "medium", "high"] }
}
}
}
# ... more tools
]
end
end
Where Chatbot Appears:
AI Features to Build (Priority Order)
Phase 1 (Launch):
1. ✅ Basic Q&A chatbot (hours, amenities, how-tos)
2. ✅ Booking assistant ("Book me a 4-person room for 2pm tomorrow")
3. ✅ Issue reporting automation
Phase 2 (Month 3-6):
4. Member matching ("Find me someone who knows Python")
5. Personalized environment (learns your preferences)
6. Smart scheduling (suggests best times based on occupancy)
Phase 3 (Month 7-12):
7. Productivity insights ("You're most productive 9-11am on Tuesdays")
8. Community event generation (AI organizes member lunches)
9. Predictive maintenance (AI detects equipment issues before they happen)
Machine Learning: Occupancy Prediction
Goal: Predict when space will be busy to optimize HVAC, suggest booking times
Approach:
1. Collect data (who's here when, desk/room usage, external factors like weather)
2. Simple model to start (linear regression or decision tree)
3. Feed predictions to members and building systems
Tools:
Implementation:
occupancy_predictor.py (separate microservice)
import pandas as pd
from sklearn.ensemble import RandomForestRegressorclass OccupancyPredictor:
def predict(self, day_of_week, hour, weather, holidays):
# Load historical data
# Train model
# Return predicted occupancy (0-100%)
pass
app/services/occupancy_service.rb
class OccupancyService
def predict_tomorrow
response = HTTParty.post('http://localhost:5000/predict',
body: {
day_of_week: Date.tomorrow.wday,
weather: fetch_weather_forecast,
holidays: is_holiday?(Date.tomorrow)
}.to_json
) response['occupancy_percentage']
end
def send_member_alerts
if predict_tomorrow > 80
Member.active.each do |member|
MemberMailer.high_occupancy_alert(member).deliver_later
end
end
end
end
4. Smart Building & IoT
IoT Hub: Home Assistant
Why Home Assistant?
Installation:
Devices to Integrate:
#### Occupancy Sensors
#### Smart Lighting
#### Climate Control
#### Environmental Monitoring
#### Security Cameras
Home Assistant Automations
Example Automations:
automation.yaml
Turn on lights when someone arrives
alias: "Workspace Occupied - Lights On"
trigger:
- platform: state
entity_id: binary_sensor.main_room_occupancy
to: 'on'
condition:
- condition: sun
after: sunset
action:
- service: light.turn_on
entity_id: light.main_workspaceEnergy saving: HVAC off when empty for 30min
alias: "Empty Space - Reduce HVAC"
trigger:
- platform: state
entity_id: binary_sensor.space_occupancy
to: 'off'
for: '00:30:00'
action:
- service: climate.set_temperature
data:
entity_id: climate.main_thermostat
temperature: 65 # Lower in winter, higher in summerAlert when air quality poor
alias: "Poor Air Quality Alert"
trigger:
- platform: numeric_state
entity_id: sensor.main_room_co2
above: 1000
action:
- service: notify.admin_phone
data:
message: "CO2 high in main room. Open windows or check ventilation."
Integration with Rails App
Home Assistant REST API:
app/services/smart_building_service.rb
class SmartBuildingService
BASE_URL = 'http://homeassistant.local:8123/api' def current_occupancy
response = HTTParty.get("#{BASE_URL}/states/sensor.total_occupancy",
headers: { 'Authorization' => "Bearer #{ENV['HA_TOKEN']}" }
)
response['state'].to_i
end
def adjust_climate_for_member(member)
# Set temperature to member's preference
temp = member.preferred_temperature || 72
HTTParty.post("#{BASE_URL}/services/climate/set_temperature",
headers: { 'Authorization' => "Bearer #{ENV['HA_TOKEN']}" },
body: {
entity_id: "climate.main_thermostat",
temperature: temp
}.to_json
)
end
def trigger_scene(scene_name)
# Activate scene (e.g., "focus mode", "social mode")
HTTParty.post("#{BASE_URL}/services/scene/turn_on",
headers: { 'Authorization' => "Bearer #{ENV['HA_TOKEN']}" },
body: { entity_id: "scene.#{scene_name}" }.to_json
)
end
end
Webhooks from Home Assistant to Rails:
Home Assistant automation that notifies Rails
alias: "Member Arrived - Notify Rails"
trigger:
- platform: event
event_type: latch_unlock
event_data:
user_id: "{{ trigger.event.data.user_id }}"
action:
- service: rest_command.notify_rails_member_arrival
data:
member_id: "{{ trigger.event.data.user_id }}"
config/routes.rb
post '/webhooks/member_arrival', to: 'webhooks#member_arrival'app/controllers/webhooks_controller.rb
class WebhooksController < ApplicationController
skip_before_action :verify_authenticity_token def member_arrival
member = Member.find(params[:member_id])
# Log arrival
member.access_logs.create(action: 'arrival', timestamp: Time.current)
# Adjust environment to their preferences
SmartBuildingService.new.adjust_climate_for_member(member)
# Send welcome notification to their phone
MemberNotificationService.new(member).send_arrival_greeting
head :ok
end
end
5. Payment & Billing
Stripe
Why Stripe?
Setup:
Gemfile
gem 'stripe'config/initializers/stripe.rb
Stripe.api_key = ENV['STRIPE_SECRET_KEY']app/models/membership.rb
class Membership < ApplicationRecord
belongs_to :user after_create :create_stripe_subscription
before_destroy :cancel_stripe_subscription
def create_stripe_subscription
customer = Stripe::Customer.create(
email: user.email,
payment_method: user.stripe_payment_method_id,
invoice_settings: { default_payment_method: user.stripe_payment_method_id }
)
subscription = Stripe::Subscription.create(
customer: customer.id,
items: [{ price: stripe_price_id }],
expand: ['latest_invoice.payment_intent']
)
update(
stripe_customer_id: customer.id,
stripe_subscription_id: subscription.id,
status: 'active'
)
end
def cancel_stripe_subscription
Stripe::Subscription.delete(stripe_subscription_id) if stripe_subscription_id
end
private
def stripe_price_id
# Map membership tier to Stripe Price ID
{
'community' => ENV['STRIPE_PRICE_COMMUNITY'],
'flex' => ENV['STRIPE_PRICE_FLEX'],
'dedicated' => ENV['STRIPE_PRICE_DEDICATED']
}[tier]
end
end
Stripe Products to Create:
Webhooks:
config/routes.rb
post '/webhooks/stripe', to: 'stripe_webhooks#create'app/controllers/stripe_webhooks_controller.rb
class StripeWebhooksController < ApplicationController
skip_before_action :verify_authenticity_token def create
payload = request.body.read
sig_header = request.env['HTTP_STRIPE_SIGNATURE']
event = Stripe::Webhook.construct_event(payload, sig_header, ENV['STRIPE_WEBHOOK_SECRET'])
case event.type
when 'invoice.payment_succeeded'
# Mark membership as active/renewed
when 'invoice.payment_failed'
# Suspend access, notify member
when 'customer.subscription.deleted'
# Cancel membership, revoke access
end
head :ok
end
end
6. Communication & Notifications
Transactional Email: Postmark or SendGrid
Postmark (~$15/month for 10K emails)
Use Cases:
Gemfile
gem 'postmark-rails'config/environments/production.rb
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { api_token: ENV['POSTMARK_API_KEY'] }app/mailers/member_mailer.rb
class MemberMailer < ApplicationMailer
def welcome_email(member)
@member = member
mail(
to: member.email,
subject: "Welcome to [Space Name]!",
template_name: 'welcome'
)
end def booking_confirmation(booking)
@booking = booking
mail(
to: booking.member.email,
subject: "Your room is booked for #{booking.start_time.strftime('%b %d at %I:%M%p')}"
)
end
end
SMS Notifications: Twilio
Use Cases:
Cost: ~$0.01/SMS
Gemfile
gem 'twilio-ruby'app/services/sms_service.rb
class SmsService
def initialize
@client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
end def send_message(to:, body:)
@client.messages.create(
from: ENV['TWILIO_PHONE_NUMBER'],
to: to,
body: body
)
end
end
Usage
SmsService.new.send_message(
to: member.phone,
body: "Your meeting room is ready! Room B, 2nd floor."
)
Community: Slack or Discord
Why?
Recommendation: Slack (Free tier)
app/services/slack_service.rb
class SlackService
def invite_member(member)
HTTParty.post('https://slack.com/api/admin.users.invite',
headers: { 'Authorization' => "Bearer #{ENV['SLACK_ADMIN_TOKEN']}" },
body: {
team_id: ENV['SLACK_TEAM_ID'],
email: member.email,
channel_ids: ENV['SLACK_DEFAULT_CHANNELS']
}
)
end def post_announcement(message)
HTTParty.post('https://slack.com/api/chat.postMessage',
headers: { 'Authorization' => "Bearer #{ENV['SLACK_BOT_TOKEN']}" },
body: {
channel: '#general',
text: message
}.to_json
)
end
end
7. Analytics & Monitoring
Application Monitoring: Honeybadger (or Sentry)
Why?
Cost: Free tier available, then ~$39/month
Setup:
Gemfile
gem 'honeybadger'config/honeybadger.yml
api_key: <%= ENV['HONEYBADGER_API_KEY'] %>
Business Analytics: Your Custom Dashboard
What to Track:
Tools:
app/controllers/admin/analytics_controller.rb
class Admin::AnalyticsController < ApplicationController
def index
@metrics = {
total_members: Member.active.count,
mrr: calculate_mrr,
occupancy_today: calculate_occupancy(Date.today),
churn_rate: calculate_churn_rate
} @occupancy_trend = last_30_days.map { |date|
{ date: date, occupancy: calculate_occupancy(date) }
}
end
private
def calculate_mrr
Member.active.joins(:membership).sum(:monthly_price)
end
def calculate_occupancy(date)
# Avg number of members present / total capacity
access_logs = AccessLog.where(date: date)
# ... logic to calculate
end
def calculate_churn_rate
# (Members who left this month / Total members at start of month) * 100
end
end
Usage Tracking: Simple Event Logging
app/models/event_log.rb
class EventLog < ApplicationRecord
# Tracks all significant events
# - member_arrival
# - booking_created
# - room_used
# - issue_reported
# - ai_interaction scope :member_arrivals, -> { where(event_type: 'member_arrival') }
scope :today, -> { where('created_at >= ?', Time.current.beginning_of_day) }
end
Log events throughout the app
EventLog.create(
event_type: 'room_booked',
member: current_member,
metadata: { room_id: @room.id, duration: params[:duration] }
)
8. Network Infrastructure
Business Internet
Verizon Fios Business or Comcast Business
Cost: ~$200-400/month depending on speed
Backup Internet (Failover):
WiFi: Ubiquiti UniFi
Why UniFi?
What to Buy:
Network Design:
Internet → UDM Pro → PoE Switch → Access Points
↓
Home Assistant, Servers, Cameras
VLANs:
Controller Dashboard:
9. Software Development Workflow
Version Control: GitHub
Repos:
coworking-platform (your Rails app)coworking-ml (Python ML models, if separate)coworking-docs (documentation, runbooks)Hosting: Render or Heroku
Render (recommended, modern, affordable)
Heroku (alternative, more expensive but simpler)
Deployment:
Push to main branch → Auto-deploy to Render
git push origin main
Render builds and deploys automatically
Background Jobs: Sidekiq
For:
Gemfile
gem 'sidekiq'app/jobs/sync_access_logs_job.rb
class SyncAccessLogsJob < ApplicationJob
queue_as :default def perform
# Fetch access logs from Latch API
# Update database
end
end
Schedule with cron (via Sidekiq-cron)
Every 5 minutes: Sync access logs
Every hour: Check for expiring memberships
Every day: Generate analytics report
Testing: RSpec
Gemfile (test group)
gem 'rspec-rails'
gem 'factory_bot_rails'
gem 'faker'Example test
spec/services/booking_service_spec.rb
RSpec.describe BookingService do
describe '#create_booking' do
it 'creates a booking for available room' do
room = create(:room)
member = create(:member) booking = BookingService.new(member).create_booking(
room: room,
start_time: 1.hour.from_now,
duration: 2
)
expect(booking).to be_persisted
expect(booking.room).to eq(room)
end
it 'raises error if room unavailable' do
# ... test conflict detection
end
end
end
10. Development Roadmap
Minimum Viable Product (Launch)
Week 1-2: Core Member Portal
Week 3-4: Booking System
Week 5-6: Access Control
Week 7-8: Admin & Polish
Phase 2: Smart Building (Month 3-6)
Phase 3: Advanced AI (Month 6-12)
11. Total Technology Costs
One-Time Hardware
| Item | Cost |
|------|------|
| Smart locks (3) | $1,500 |
| Home Assistant hub (Raspberry Pi + accessories) | $150 |
| WiFi equipment (UDM Pro + 2-3 APs + switch) | $1,200 |
| Sensors (10 occupancy + 3 climate + 2 air quality) | $600 |
| Smart lighting (20 bulbs or switches) | $400 |
| Cameras (4) | $200 |
| Tablets for displays (2) | $400 |
| Total Hardware | ~$4,500 |
Monthly Software/Services
| Item | Cost |
|------|------|
| Internet (business, 500 Mbps) | $300 |
| Hosting (Render: web + DB + workers) | $50 |
| Stripe (2.9% + $0.30 per transaction) | ~$200* |
| Latch subscription (3 locks) | $40 |
| Anthropic API (AI chatbot) | $50 |
| Postmark (email) | $15 |
| Twilio (SMS) | $20 |
| G Suite (email, calendar) | $12 |
| Honeybadger (monitoring) | $40 |
| Slack (free tier) | $0 |
| Total Monthly | ~$730 |
*Assuming $7K monthly revenue, Stripe fees ≈ $210
Annual Licenses
| Item | Cost |
|------|------|
| Domain name | $15 |
| SSL certificate (Let's Encrypt) | $0 |
| Misc SaaS tools | $100 |
| Total Annual | ~$115 |
Total First-Year Technology Costs: ~$4,500 (hardware) + $8,760 (monthly × 12) + $115 (annual) = ~$13,400
Ongoing: ~$730/month or $8,760/year
12. Security & Privacy
Data Protection
GDPR/Privacy Compliance:
Application Security:
Physical Security:
Backup Strategy
Database Backups:
Code:
Physical Space:
13. Support & Maintenance
Member Support Workflow
1. First Line: AI Chatbot
- Handles 80% of common questions
- Available 24/7 in member portal
2. Second Line: Issue Ticketing
- Member reports issue via chatbot or form
- Creates ticket in your admin dashboard
- You get notification (email/SMS)
- You respond or fix
3. Escalation: Direct Contact
- If chatbot can't help, member can email/call you
- Aim for <2 hour response time during business hours
Maintenance Schedule
Daily:
Weekly:
Monthly:
Quarterly:
Summary
You're building:
Your unique advantages:
Timeline:
Next step:
Start with member portal (authentication + Stripe + basic booking). Get that working, then layer on smart access, then IoT, then advanced AI features.
Build incrementally. Ship fast. Iterate based on real usage.