Skip to content

Folder Locations

Angel Rey edited this page Dec 23, 2020 · 1 revision

Top-Level Config & Data

oddslingers.poker/
    env/
        dev.env       // defaults for each environment
        beta.env
        prod.env
        ...
        secrets.env   // machine-specific settings (e.g. DB password)

    etc/              // config files used by our services, e.g. nginx, supervisord, etc.
        supervisor/
        nginx/
        ...
    
    bin/              // shell commands used for development, deploying, setup, etc
        oddslingers
        oddslingers-server
        setup-dev-mac
        ...

    data/             // all mutable data used by the project, this is the folder to back up (e.g. database contents, logs, debug dumps, etc.)
        logs/
        database/
        redis/
        support_tickets/
        caches/
        debug_dumps/

    core/    // (main codebase, see below)

Python

The backend is a monolithic web app built on Django, PostgreSQL, and Redis. The root app is oddslingers and the web UI is under ui/.

core/
    manage.py           // django project root

    static/             // staticfiles
    templates/          // django templates
    js/                 // javascript (see below)

    oddslingers/        // main root app
        models.py
        settings.py

    ui/
        urls.py         // web urls
        views/
            pages.py    // web views
            api.py      // web api endpoints
            base_views.py

    ...

Javascript

The web front-end is built with React & Redux on ES6. JS is compiled from js/ to js/build (aka static/js) during development and commited to git as production-ready files.

Self-contained modules like websocket, webrtc, poker, etc. get their own folders, each with their corresponding components, reducers, tests, etc.

js/
    module1/            // self-contained modules in module folders, with functions split by file
        tests.js
        reducers.js
        containers.js
        components.js
        ....
    module2/
        ...

    util/
        ...             // for small snippets & helper functions shared between modules

    tests/              // tests are simlinked to tests.js files from modules
        module1.js@ -> ../module1/tests.js
        module2.js@ -> ../module2/tests.js