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.*
: usedotenv
to set environment variables indevelopment
andtest
environments. -
Makefile
: use aMakefile
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.
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.