A simple chat application built with Erlang (backend) and React with TypeScript (frontend), containerized using Docker.
- Real-time Communication: WebSocket-based chat functionality.
- Scalable Architecture: Backend built with Erlang/OTP for high concurrency and fault tolerance.
- Modern Frontend: Responsive UI built with React and TypeScript.
- Containerization: Easy deployment using Docker and Docker Compose.
- Continuous Integration: Automated testing and building with GitHub Actions.
This project is licensed under the Apache License 2.0.
- The Erlang Docs
- Adopting Erlang by Tristan Sloughter, Fred Hebert, and Evan Vigil-McClanahan
- The Cowboy Documentation by Loïc Hoguin
- Learn You Some Erlang for Great Good! by Fred Hebert
- ... and of course a myriad of other resources and contributors
- Erlang/OTP 26 Erts 14.2.5
- rebar 3.23.0
- Node.js 18.x
- Docker
- Docker Compose
.
├── client/ # React frontend
└── server/ # Erlang backend
-
Navigate to the
server
directory:cd server
-
Install dependencies:
rebar3 get-deps
-
Compile the backend:
rebar3 compile
-
Run the backend server:
rebar3 shell
- The backend runs on port 8080 by default.
-
Navigate to the
client
directory:cd client
-
Install dependencies:
npm install
-
Start the development server:
npm start
- The frontend runs on port 3000 by default.
- The app should automatically open in your default browser.
- The frontend is configured to proxy API requests to the backend.
NOTE: Hot reloading is much slower when using Docker Compose compared to running the frontend and backend separately.
For an integrated development environment, you can use Docker Compose to run both the frontend and backend:
-
Build the Docker image:
docker-compose down; docker-compose build
-
Start the server (with live code reloading):
docker-compose up chat_server_development --watch
-
Access the application:
- Visit http://localhost:8080 to access the frontend served by the backend.
-
Navigate to the
server
directory:cd server
-
Run EUnit and Common Test suites:
rebar3 do eunit, ct
-
Run Dialyzer for static analysis:
rebar3 dialyzer
-
Navigate to the
client
directory:cd client
-
Run tests:
npm test
- Press
a
to run all tests.
- Press
-
Run ESLint for linting:
npm run lint
-
Build the Docker image:
docker-compose -f docker-compose.prod.yml build
-
Start the server in production mode:
docker-compose -f docker-compose.prod.yml up
-
Access the application:
- Visit
http://localhost:8080
to access the application.
- Visit
Contributions are welcome! Here's how you can help:
-
Fork the repository.
-
Create a new branch:
git checkout -b feature/YourFeature
-
Make your changes and commit them:
git commit -m 'Add some feature'
-
Push to the branch:
git push origin feature/YourFeature
-
Open a pull request.
For any questions or inquiries, please contact Zac Bolton.
This project serves as a practical example of Erlang and React development with Docker containerization. It aims to provide a solid foundation for further development and potential commercial use. Feedback and suggestions are greatly appreciated.
-
CI/CD Pipeline:
- The project uses GitHub Actions for continuous integration (CI).
- The pipeline includes testing, and building.
- See the
.github/workflows/ci.yml
file for details.
-
Caching and Optimization:
- Dependencies are cached in the CI pipeline to speed up builds.
- Frontend and backend jobs run in parallel to reduce build times.
-
Backend:
- Erlang/OTP 26
- rebar3
-
Frontend:
- React
- TypeScript
- Node.js 22.9.0
- npm
Special thanks to all the contributors and the open-source community for their invaluable resources and support. See the Honorable Mentions section for more details.