Skip to content

Latest commit

 

History

History
101 lines (80 loc) · 5.09 KB

File metadata and controls

101 lines (80 loc) · 5.09 KB

Rails Route Comparison Tool

Overview

This is a full-stack web application designed to compare Ruby on Rails routes files between any two Rails projects. The application allows users to upload routes.rb files with custom project names, parse them to extract route information, and perform detailed comparisons to identify common routes, project-specific routes, and differences in route implementations.

The system provides a visual interface for analyzing route similarities and differences, making it easier for developers to understand the routing structure across different applications or versions. Originally built for comparing Desidime and Pepper platforms, it has been generalized to work with any Rails projects.

User Preferences

Preferred communication style: Simple, everyday language.

System Architecture

Frontend Architecture

  • Framework: React 18 with TypeScript
  • Routing: Wouter for client-side routing
  • UI Framework: Radix UI components with shadcn/ui design system
  • Styling: Tailwind CSS with custom design tokens and CSS variables
  • State Management: TanStack Query (React Query) for server state management
  • Form Handling: React Hook Form with Zod validation
  • Build Tool: Vite for development and production builds

Backend Architecture

  • Runtime: Node.js with Express.js framework
  • Language: TypeScript with ES modules
  • API Pattern: RESTful API design
  • File Handling: Multer for file upload processing
  • Route Parsing: Custom Ruby route parser for analyzing Rails routes files
  • Storage: In-memory storage implementation with interface for future database integration

Data Storage Solutions

  • Database ORM: Drizzle ORM configured for PostgreSQL
  • Database Provider: Neon Database (serverless PostgreSQL)
  • Schema Management: Drizzle Kit for migrations and schema changes
  • Current Implementation: Memory-based storage for development, with database schema ready for production

Database Schema

  • route_files: Stores uploaded routes files with metadata (platform, content, upload timestamp)
  • route_comparisons: Stores comparison results linking two route files with analysis data
  • Relationships: Foreign key relationships between comparisons and route files

Authentication and Authorization

  • Current State: No authentication implemented
  • Session Management: Connect-pg-simple configured for PostgreSQL session storage (ready for future implementation)

Route Processing System

  • Parser Architecture: Object-oriented Ruby route parser that analyzes routes.rb files
  • Route Analysis: Extracts method, path, controller, action, helper names, and route types
  • Comparison Engine: Identifies common routes, platform-specific routes, and differences
  • Route Types: Supports resource routes, custom routes, namespaces, member routes, and collection routes

API Endpoints

  • POST /api/upload: File upload endpoint with platform specification and validation
  • POST /api/compare: Route comparison endpoint that processes two uploaded files
  • GET /api/comparison: Retrieves latest comparison results

File Processing Pipeline

  1. Upload Validation: Restricts to .rb files with 5MB size limit
  2. Content Processing: Converts uploaded files to UTF-8 strings
  3. Route Parsing: Extracts route definitions using custom Ruby parser
  4. Comparison Analysis: Identifies similarities and differences between route sets
  5. Result Storage: Saves comparison results for retrieval

Development Workflow

  • Hot Reload: Vite HMR for frontend development
  • Error Handling: Runtime error overlay for development
  • Logging: Structured logging for API requests with performance metrics
  • Build Process: Separate build steps for frontend (Vite) and backend (esbuild)

External Dependencies

Core Framework Dependencies

  • @neondatabase/serverless: Serverless PostgreSQL database connectivity
  • drizzle-orm: TypeScript ORM for database operations
  • drizzle-zod: Schema validation integration
  • express: Web application framework
  • multer: File upload middleware

Frontend UI Dependencies

  • @radix-ui/*: Comprehensive set of unstyled UI primitives (accordion, dialog, dropdown, select, etc.)
  • @tanstack/react-query: Server state management and caching
  • tailwindcss: Utility-first CSS framework
  • wouter: Lightweight client-side routing

Development Tools

  • vite: Frontend build tool and development server
  • tsx: TypeScript execution for Node.js
  • esbuild: JavaScript bundler for production builds
  • @replit/vite-plugin-runtime-error-modal: Development error handling
  • @replit/vite-plugin-cartographer: Replit-specific development tooling

Validation and Type Safety

  • zod: Runtime type validation and schema definition
  • @hookform/resolvers: Form validation resolver integration
  • react-hook-form: Form state management and validation

Utility Libraries

  • date-fns: Date manipulation and formatting
  • clsx and class-variance-authority: Conditional CSS class management
  • nanoid: Unique ID generation