Programmar is a web application designed to help users learn programming languages. The application is built using a custom PHP MVC architecture without external frameworks, adhering to SOLID principles.
The current database schema consists of three main tables handling users, courses, and their relationships.
- Tables:
users,courses,user_courses - Relationships:
- One-to-Many:
userstouser_courses - Many-to-Many:
userstocourses(viauser_courses)
- One-to-Many:
erDiagram
USERS {
int id PK
varchar email UK
varchar password
varchar name
int ram "Default: 5"
timestamp last_ram_check
timestamp updated_at
timestamp created_at
}
COURSES {
int id PK
varchar title
text description
varchar icon
boolean is_visible
timestamp created_at
}
USER_COURSES {
int user_id PK, FK
int course_id PK, FK
int completed_lessons
boolean current_lesson_status
timestamp last_accessed
}
USERS ||--o{ USER_COURSES : "enrolls in"
COURSES ||--o{ USER_COURSES : "is taken by"
The project follows the Model-View-Controller (MVC) pattern:
- Controllers: Handle request logic (e.g.,
SecurityController,CourseController). - Repositories: Manage database operations (e.g.,
UserRepository). - Services: Handle external data fetching (e.g.,
ContentService). - Views: HTML templates rendered by the controllers.
graph LR
Browser --> Nginx
Nginx --> Router[Routing.php]
Router --> Controller
Controller --> Service
Controller --> Repository
Repository --> Database[(PostgreSQL)]
Service --> ExtAPI[Content Service]
- Login Page:
docs/screenshots/login.png - Dashboard:
docs/screenshots/dashboard.png - Course Catalog:
docs/screenshots/catalog.png
- Docker
- Docker Compose
-
Build and run the containers:
docker-compose up -d --build
-
Access the application:
- Web App: http://localhost:9000
- Database: http://localhost:9002
-
Authentication:
- Navigate to
/registerand create an account. - Log in at
/login. - Verify redirection to
/dashboard. - Attempt to access
/dashboardafter logging out (should redirect to login).
- Navigate to
-
Course Management:
- Navigate to
/coursesand start a course. - Verify the course appears in
/my-courses.
- Navigate to
- Unit/Integration Tests: Run PHPUnit tests for repositories.
docker-compose exec php vendor/bin/phpunit tests/ - API Endpoint Tests: Run the Bash script to check HTTP status codes.
bash tests/api_tests.sh
- Topic Approved
- Technologies: Docker, GIT, HTML5, CSS, JS, PHP, PostgreSQL
- No Frameworks used
- MVC Architecture
- Aesthetic and Responsive Design (CSS)
- Security (Session, Password Hashing, CSRF)
- Login Process
- Session Maintenance
- User Permissions (RAM System)
- User Management (Register, Update, Delete)
- Logout
- Relational Structure (1:N, M:N)
- Relation 1:1 (does not make sense in the context of this project)
- Minimum 2 Views (does not make sense in the context of this project)
- Minimum 1 Trigger
- Minimum 1 Function
- Transactions on appropriate isolation level
- 3NF Normalization
- Exported SQL file (
init.sql)
- README.md
- ERD Diagram
- Screenshots
- Architecture Diagram
- Startup Instructions
- Test Scenarios
- Checklist
- SOLID Principles
- Git Repository History
- No Code Duplication
- Global Error Handling (400, 403, 404, 500)
Actual exercises are located in a different repository and are proprietary.
Assume that if any exercise is on the master branch in this repository it also uses MIT License.
If any exercise is on a non-master branch, assume it is there by mistake and should not be used or shared.
This project is licensed under the MIT License - see the LICENSE for details.