A full-stack application built with Symfony 6.4 backend (MongoDB) and Next.js frontend for managing articles with user authentication.
- RESTful API built with Symfony 6.4
- MongoDB integration for data storage
- JWT authentication
- Article management (CRUD operations)
- Comprehensive validation
- Test coverage with PHPUnit
- Docker-based development environment
- Modern UI built with Next.js
- TypeScript support
- Tailwind CSS for styling
- Responsive design
- JWT-based authentication
- Real-time form validation
- Article management interface
- Docker and Docker Compose
- Make (optional, but recommended)
- Clone the repository:
git clone https://github.com/abdel1touimi/ams.git
cd ams
- Copy the environment files:
cp .env.template .env
cp backend/.env.template backend/.env
- Update the environment variables in
.env
:
- Adjust values as needed (keys, ports, database credentials, etc.)
- Initialize the project using Make:
make init
This command will:
- Build and start Docker containers
- Install Composer dependencies
- Generate JWT keys
- Clear Symfony cache
- Install frontend dependencies
- Build frontend assets (in production mode)
├── backend/ # Symfony backend application
│ ├── src/
│ │ ├── Controller/ # API endpoints
│ │ ├── Document/ # MongoDB document classes
│ │ ├── DTO/ # Data Transfer Objects
│ │ ├── Exception/ # Custom exceptions
│ │ ├── Repository/ # Data access layer
│ │ ├── Response/ # API response formatting
│ │ ├── Serializer/ # Data serialization
│ │ ├── Service/ # Business logic
│ │ └── Validator/ # Input validation
│ └── tests/
│ ├── Unit/ # Unit tests
│ └── Functional/ # Functional tests
│
├── frontend/ # Next.js frontend application
│ └── src
│ ├── app/ # Main application layout
│ ├── components/ # Reusable components
│ ├── context/ # Context providers
│ ├── services/ # API services
│ ├── types/ # TypeScript types
│ └── utils/ # Utility functions
│
├── configs/ # Configuration files
│ ├── nginx/ # Nginx configuration
│ ├── php/ # PHP configuration
│ └── node/ # Node.js configuration
│
├── docker-compose.yml # Docker composition
└── Makefile # Make commands
After running make up
, you can access:
- Frontend:
http://localhost
- Backend API:
http://localhost/api
POST /api/register
- Register a new userPOST /api/login
- Login and get JWT tokenGET /api/me
- Get current user profilePUT /api/me
- Update user profilePUT /api/me/password
- Change password
GET /api/articles
- List user's articlesPOST /api/articles
- Create new articleGET /api/articles/{id}
- Get article detailsPUT /api/articles/{id}
- Update articleDELETE /api/articles/{id}
- Delete article
# Start development environment
make up
# Stop environment
make down
# View logs
make logs
# Backend Commands
make symfony-bash # Access Symfony container
make composer-install # Install PHP dependencies
make symfony-cache-clear # Clear Symfony cache
# Frontend Commands
make frontend-dev # Start frontend development server
make frontend-build # Build frontend for production
make frontend-lint # Run frontend linting
make frontend-lint-fix # Fix frontend linting issues
# Database Commands
make mongo-shell # Access MongoDB shell
# Testing Commands
make test # Run all tests
make test-unit # Run unit tests
make test-functional # Run functional tests
make test-coverage # Generate test coverage report
# Utility Commands
make clean # Clean up everything
make restart # Restart all containers
make validate # Validate project configuration
- Start the development environment:
make up
- For frontend development with hot reloading:
make frontend-dev
- For backend development, you can access the Symfony container:
make symfony-bash
The project includes comprehensive test coverage:
# Run all tests
make test
# Run specific test suites
make test-unit
make test-functional
# Generate coverage report
make test-coverage
- Main configuration:
backend/.env
- Test configuration:
backend/.env.test
- PHP configuration:
configs/php/php.ini
- Nginx configuration:
configs/nginx/default.conf
- Environment variables:
.env
- Next.js configuration:
frontend/next.config.js
- TypeScript configuration:
frontend/tsconfig.json
- Nginx configuration:
configs/nginx/default.conf
MongoDB connection settings can be configured in:
.env
for developmentbackend/.env
for the Symfony environmentbackend/.env.test
for testing
- JWT authentication using
lexik/jwt-authentication-bundle
- Password hashing using Symfony's password hasher
- CORS configuration using
nelmio/cors-bundle
- Input validation on both frontend and backend
- Secure HTTP headers with Nginx configuration
The API uses standardized error responses:
{
"success": false,
"message": "Error message",
"data": {
"field": "Specific error description"
}
}
Common HTTP status codes:
- 200: Success
- 201: Resource created
- 400: Bad request
- 401: Unauthorized
- 422: Validation error
- 404: Resource not found