# nipeshkc7/beating-bookies architecture

> Architecture diagram of the GitHub repository nipeshkc7/beating-bookies, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nipeshkc7/beating-bookies
- Repository: https://github.com/nipeshkc7/beating-bookies

## Overview

##### Component Relationships

- Client → Server: RESTful API calls
- Server → SQLite: Data persistence
- Server → External Services:
- Google OAuth for authentication
- AWS Lambda for odds data
- DynamoDB for sports data

##### Specific Implementation Details

Key architectural elements:
- Authentication flow with both Google OAuth and email
- Betting calculators architecture
- Data flow for bet tracking
- Integration with odds API through Lambda
- State management pattern

##### Additional Elements

- Docker containers (shown in Dockerfile presence)
- CI/CD pipeline (from GitHub Actions)
- Netlify deployment

- The clear separation between frontend and backend
- The microservices-like architecture for different betting calculations
- The security layer with authentication
- External service dependencies
- Data persistence strategy

Key Technical Considerations:
- How the Vue.js frontend communicates with the Node.js backend
- Role of Vuex in state management
- Demonstrate the flow of betting data through the system
- Scalability of the architecture
- Error handling pathways

Remember to:
- Use consistent symbols throughout
- Brief annotations for complex flows
- Both synchronous and asynchronous communications

This system design should reflect the modern web application architecture while highlighting the specific betting-related features that make this application unique.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        FE_Auth["Authentication Components"]
        FE_Bets["Betting Interface"]
        FE_Calc["Calculators"]
        FE_Store["Vuex Store"]
        FE_Router["Vue Router"]
        
        FE_Auth --> FE_Store
        FE_Bets --> FE_Store
        FE_Calc --> FE_Store
        FE_Store --> FE_Router
    end

    subgraph Server
        BE_Controllers["Controllers Layer"]
        BE_Services["Services Layer"]
        BE_Routes["Routes Layer"]
        BE_Auth["Auth Layer"]
        BE_DB["Database Interface"]
        BE_Error["Error Handler"]

        BE_Routes --> BE_Controllers
        BE_Controllers --> BE_Services
        BE_Services --> BE_DB
        BE_Auth --> BE_Controllers
        BE_Error --> BE_Controllers
    end

    subgraph External
        AWS["AWS Lambda"]
        DynamoDB["DynamoDB"]
        GoogleOAuth["Google OAuth"]
        OddsAPI["The Odds API"]
        SQLite[(SQLite DB)]
    end

    Client --> BE_Routes
    BE_Services --> AWS
    BE_Services --> DynamoDB
    BE_Auth --> GoogleOAuth
    AWS --> OddsAPI
    BE_DB --> SQLite

    %% Click events for components
    click FE_Auth "https://github.com/nipeshkc7/beating-bookies/blob/master/client/src/views/login.vue"
    click FE_Bets "https://github.com/nipeshkc7/beating-bookies/blob/master/client/src/components/BetsTable.vue"
    click FE_Calc "https://github.com/nipeshkc7/beating-bookies/blob/master/client/src/components/Calculators.vue"
    click FE_Store "https://github.com/nipeshkc7/beating-bookies/blob/master/client/src/store/index.js"
    click FE_Router "https://github.com/nipeshkc7/beating-bookies/blob/master/client/src/router/index.js"
    click BE_Controllers "https://github.com/nipeshkc7/beating-bookies/tree/master/server/controllers"
    click BE_Services "https://github.com/nipeshkc7/beating-bookies/tree/master/server/services"
    click BE_Routes "https://github.com/nipeshkc7/beating-bookies/tree/master/server/routes"
    click BE_Auth "https://github.com/nipeshkc7/beating-bookies/blob/master/server/util/authorize.js"
    click BE_DB "https://github.com/nipeshkc7/beating-bookies/blob/master/server/init-db.js"
    click BE_Error "https://github.com/nipeshkc7/beating-bookies/blob/master/server/util/error.js"

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef error fill:#e74c3c,stroke:#c0392b,color:white

    class FE_Auth,FE_Bets,FE_Calc,FE_Store,FE_Router frontend
    class BE_Controllers,BE_Services,BE_Routes,BE_Auth,BE_DB backend
    class AWS,DynamoDB,GoogleOAuth,OddsAPI external
    class SQLite database
    class BE_Error error
```
