• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
rohitr21

rohitr21

untitled-4063

Public
Like
untitled-4063
Home
Code
5
backend
5
frontend
6
shared
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
index.ts
https://rohitr21--957905803eea11f0bdac76b3cceeab13.web.val.run
README.md

GYM Management System

A comprehensive digital gym management solution built with modern web technologies to replace paper-based receipt systems and manual communication processes.

🎯 Project Overview

This system addresses key challenges in gym management:

  • Digital Receipt Management: Eliminates paper receipts with secure digital storage
  • Automated Notifications: Streamlines communication between gym owners and members
  • Comprehensive Member Management: Complete CRUD operations for member data
  • Payment Tracking: Automated billing and fee management
  • Future-Ready: Expandable for supplement stores, nutrition advice, and personal training

🏗️ Architecture

Technology Stack

  • Frontend: React 18.2.0 with TypeScript
  • Backend: Hono.js API framework
  • Database: Firebase Firestore
  • Authentication: Firebase Auth
  • Styling: TailwindCSS
  • Hosting: Val Town Platform

System Design

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Admin Panel   │    │  Member Portal  │    │   User Portal   │
│                 │    │                 │    │                 │
│ • Member CRUD   │    │ • View Bills    │    │ • View Details  │
│ • Billing       │    │ • Notifications │    │ • Search Records│
│ • Notifications │    │ • Profile Mgmt  │    │ • Public Info   │
│ • Reports       │    │                 │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         └───────────────────────┼───────────────────────┘
                                 │
                    ┌─────────────────┐
                    │   Hono API      │
                    │                 │
                    │ • Authentication│
                    │ • CRUD Ops      │
                    │ • Billing Logic │
                    │ • Notifications │
                    └─────────────────┘
                                 │
                    ┌─────────────────┐
                    │   Firebase      │
                    │                 │
                    │ • Firestore DB  │
                    │ • Authentication│
                    │ • Cloud Storage │
                    └─────────────────┘

🚀 Features

Admin Module

  • ✅ Secure login system
  • ✅ Add/Update/Delete members
  • ✅ Create and manage bills
  • ✅ Assign fee packages
  • ✅ Monthly notification system
  • ✅ Export reports
  • ✅ Supplement store management
  • ✅ Diet details management

Member Module

  • ✅ Member login portal
  • ✅ View digital bill receipts
  • ✅ Receive bill notifications
  • ✅ Profile management

User Module (Public)

  • ✅ Public login
  • ✅ View gym details
  • ✅ Search member records (authorized)

📁 Project Structure

├── backend/
│   ├── database/
│   │   ├── firebase.ts      # Firebase configuration
│   │   ├── models.ts        # Data models and types
│   │   └── queries.ts       # Database query functions
│   ├── routes/
│   │   ├── admin.ts         # Admin routes
│   │   ├── members.ts       # Member routes
│   │   ├── auth.ts          # Authentication routes
│   │   └── static.ts        # Static file serving
│   ├── middleware/
│   │   ├── auth.ts          # Authentication middleware
│   │   └── logging.ts       # Request logging
│   ├── utils/
│   │   ├── logger.ts        # Logging utility
│   │   └── validation.ts    # Input validation
│   └── index.ts             # Main API entry point
├── frontend/
│   ├── components/
│   │   ├── admin/           # Admin components
│   │   ├── member/          # Member components
│   │   ├── common/          # Shared components
│   │   └── App.tsx          # Main app component
│   ├── pages/
│   │   ├── AdminDashboard.tsx
│   │   ├── MemberDashboard.tsx
│   │   └── Login.tsx
│   ├── services/
│   │   ├── api.ts           # API service layer
│   │   └── firebase.ts      # Firebase client config
│   ├── utils/
│   │   └── helpers.ts       # Utility functions
│   ├── index.html           # Main HTML template
│   ├── index.tsx            # Frontend entry point
│   └── style.css            # Custom styles
├── shared/
│   ├── types.ts             # Shared TypeScript types
│   └── constants.ts         # Shared constants
└── tests/
    ├── unit/                # Unit tests
    ├── integration/         # Integration tests
    └── e2e/                 # End-to-end tests

🔧 Setup Instructions

Prerequisites

  • Val Town account
  • Firebase project setup
  • Environment variables configured

Environment Variables

FIREBASE_API_KEY=your_api_key FIREBASE_AUTH_DOMAIN=your_auth_domain FIREBASE_PROJECT_ID=your_project_id FIREBASE_STORAGE_BUCKET=your_storage_bucket FIREBASE_MESSAGING_SENDER_ID=your_sender_id FIREBASE_APP_ID=your_app_id

Installation & Deployment

  1. Clone/Fork this Val Town project

  2. Configure Firebase:

    • Create a new Firebase project
    • Enable Firestore Database
    • Enable Authentication (Email/Password)
    • Add environment variables to Val Town
  3. Deploy:

    • The project auto-deploys on Val Town
    • Access via the provided HTTP endpoint

🧪 Testing Strategy

Test Cases

Authentication Tests

  • ✅ Valid login credentials
  • ✅ Invalid login attempts
  • ✅ Session management
  • ✅ Role-based access control

Member Management Tests

  • ✅ Add new member with valid data
  • ✅ Update existing member information
  • ✅ Delete member and cascade operations
  • ✅ Search and filter members

Billing System Tests

  • ✅ Create bills with different fee packages
  • ✅ Payment processing and receipt generation
  • ✅ Notification delivery
  • ✅ Report generation

Data Integrity Tests

  • ✅ Input validation
  • ✅ Database constraints
  • ✅ Error handling
  • ✅ Data backup and recovery

Running Tests

# Unit tests npm test # Integration tests npm run test:integration # E2E tests npm run test:e2e

📊 Performance Optimizations

Code Level

  • Lazy Loading: Components loaded on demand
  • Memoization: React.memo for expensive components
  • Debouncing: Search and input operations
  • Bundle Splitting: Separate chunks for admin/member/user modules

Architecture Level

  • Serverless: Val Town's serverless architecture for auto-scaling
  • CDN: Static assets served via CDN
  • Database Indexing: Optimized Firestore queries
  • Caching: Client-side caching for frequently accessed data

Database Optimizations

  • Compound Queries: Efficient Firestore query patterns
  • Pagination: Large datasets handled with pagination
  • Real-time Updates: Firestore listeners for live data
  • Offline Support: PWA capabilities for offline access

🔒 Security Features

  • Authentication: Firebase Auth with secure token management
  • Authorization: Role-based access control (Admin/Member/User)
  • Input Validation: Server-side validation for all inputs
  • Data Encryption: Firebase handles encryption at rest and in transit
  • Audit Logging: Comprehensive logging for all operations

📈 Monitoring & Logging

Logging Strategy

  • Request Logging: All API requests logged with timestamps
  • Error Logging: Detailed error tracking with stack traces
  • User Actions: Audit trail for all user operations
  • Performance Metrics: Response times and resource usage

Log Levels

  • ERROR: System errors and exceptions
  • WARN: Warning conditions
  • INFO: General information
  • DEBUG: Detailed debugging information

🚀 Future Enhancements

  1. Supplement Store Module

    • Product catalog management
    • Inventory tracking
    • Online ordering system
  2. Nutrition Module

    • Diet plan creation
    • Calorie tracking
    • Nutritionist consultations
  3. Personal Training Module

    • Trainer scheduling
    • Workout plan management
    • Progress tracking
  4. Mobile App

    • React Native mobile application
    • Push notifications
    • Offline capabilities

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📞 Support

For support and questions:

  • Create an issue in the repository
  • Contact the development team
  • Check the documentation wiki

Built with ❤️ using Val Town Platform

HTTP
  • index.ts
    rohitr21--95…13.web.val.run
Code
backendfrontendsharedREADME.mdmain.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.