C++ Web Application Framework created from scratch. Inspired by Express and Django.
In the beginning, it was a simple HTTP server built using sockets in C++, but it evolved into a flexible and minimal framework for building web applications.
My C++, DSA, and Networking skills were honed by developing this project and I gained a deep understanding of how servers operate.
- Dynamic Router
- URL Path Params and Query String Support
- Response Status Codes
- JSON Parser and Creator
- JSON Body Support in Requests and Responses
- Cookies Support
- Automatic Public File Indexing and Parsing
- Routing and Controller Structure Similar to Express
- Request Redirect
- HTML Page Support
- Static Fields
- ETags for Client Side Caching
- Monitor for Live Restart ./monitor/DOCUMENTATION.md
Currently, this project only runs on Linux, but I plan to add support for Windows and Mac in the future.
- Linux Operating System
- C++ Compiler
- cmake
- Git
Clone the project
git clone https://github.com/Suhaan-Bhandary/Crystal-Web-Framework
Go to the project directory
cd Crystal-Web-Framework
Install Dependencies
sudo ./ubuntu_setup.sh # select option 1 for install
Compile the Server
rm -rf ./build
./scripts/debug_configure.sh
./scripts/build.sh
Run the Server
./scripts/run_example.sh
You will see the below output after running
Listening on Address: 127.0.0.1
Port: 8080
To use live restart functionality use the monitor bash script.
Before running the monitor file uncomment the #CUSTOM_MACROS = -DDEVELOPMENT_ENVIRONMENT
in the Makefile
./monitor/monitor.sh
To run the server on Docker
docker build -t http-server-cpp .
docker run -p 8080:8080 -t http-server-cpp
To run tests, run the following command
rm -rf ./build
./scripts/debug_configure.sh
./scripts/build.sh
./scripts/run_test.sh
To Create a Web Application user can edit the app/ folder in the project.
- app/Router: Define the routes of the Web Application.
- app/Controller: Stores the controllers for each route.
- app/public: Store all the files which are to be made public to the internet.
- app/templates: It is used to store all the html template.
Currently, it only supports Linux, but other platforms will be supported incrementally in the future.
It uses the MVC model to structure the Web Application.
It supports main features and in future new features like Template Engine, Database, Session and many more.
If you have any feedback, please reach out to us at [email protected]
“The secret of getting ahead is getting started. The secret of getting started is breaking your complex overwhelming tasks into small manageable tasks, and then start on the first one.” — Mark Twain