Web πŸ•Έ

Hero image for Web πŸ•Έ

Project Structure

The team generally uses battle-tested-and-proven Web frameworks to build applications. However, not all frameworks provide a standardized project structure. For the latter, refer to the general conventions to structure a project.

Frameworks

Refer to the following existing guides and project templates for the main Web frameworks the team uses:

Project structure in a Phoenix application

Project structure in a Ruby on Rails application

For other frameworks, refer to the official documentation and follow the community guidelines.

General Conventions

The following structure and directories must be followed unless specified otherwise by a framework:

project-name-web
β”œβ”€ config/
β”œβ”€ lib/
β”‚  β”œβ”€ controllers/
β”‚  β”œβ”€ decorators/
β”‚  β”œβ”€ forms/
β”‚  β”œβ”€ helpers/
β”‚  β”œβ”€ models/
β”‚  β”œβ”€ presenters/
β”‚  β”œβ”€ repositories/
β”‚  β”œβ”€ serializers/
β”‚  β”œβ”€ services/
β”‚  └─ views/
β”œβ”€ tests/
β”œβ”€ .env
β”œβ”€ .env.dev
β”œβ”€ .env.example
β”œβ”€ .env.test
β”œβ”€ docker-compose.dev.yml
β”œβ”€ docker-compose.test.yml
β”œβ”€ Dockerfile
└─ Makefile
└─ README.md
  • config: static and dynamic configuration and initialization logic.
  • lib: domain logic and presentation layer for the whole application. The sub-directories are self-explanatory.
  • tests: the test suite and its configuration.
  • .env.*: use dotenv to set environment variables in development and test environments.
  • Makefile: use a Makefile to define executable CLI scripts.

Development Environment

Code Editor

No specific editor is enforced at the team level. Web developers can pick what they are comfortable with but also what does not hinder their productivity.

The following options are the most widely used:

  • Visual Studio Code.
  • JetBrain’s IDEs such as RubyMine and GoLand.
  • Vim.

The team maintains an extension pack for Visual Studio Code with a curated list of extensions. Contribute to the pack by opening a pull request.

Tools

The following tools are required for all Web projects:

  • Docker Desktop and Docker Compose are required to run Web applications locally. Instead of running databases - such as PostgreSQL, Redis but also ElasticSearch - directly on the host machine, these dependencies run in isolation in local containers.
  • A GUI tool such as pgAdmin or Postico to interact visually with PostgreSQL databases.
  • A powerful terminal replacement such as iTerm.

Version Managers

Due to the diversity of projects the team works on, each application usually requires different versions of programming languages. Versions managers allow to install and switch between different versions effortlessly.

The recommended version manager is asdf. It provides first party support for Ruby, Node.js, Elixir (and Erlang). Support for other programming languages can be added via community plugins.

asdf comes pre-installed as part of the team’s laptop script.