- 🇷🇺 Russian Documentation - Documentation in Russian.
This project is a web application that allows users to publish content, rate posts, search, comment, upvote/downvote, and includes an admin panel for user management and post deletion. The application utilizes a microservices architecture and can be deployed locally using Docker.
- Publishing Content: Users can create and edit posts.
- Rating System: Users can like and dislike posts.
- Search: Ability to search posts by keywords and users by username.
- Comments: Users can leave comments on posts.
- Upvote/Downvote System: Users can vote for or against posts.
- Admin Panel: Administrators can manage users and delete posts.
Frontend library for building user interfaces.
Backend framework for building web applications and APIs.
Lightweight relational database.
Platform for developing, shipping, and running applications in containers.
Web server for proper request redirection.
Standard for creating access tokens.
Library for hashing passwords.
JavaScript runtime environment outside the browser.
Library for making HTTP requests.
-
Setup Environment
Edit the
.env
file in the project's root directory and replace the following environment variables:SECRET_KEY=your_secret_key ADMIN_USERNAME=admin ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=123098
-
Run the server and client simultaneously
You can start both the server and client with one command:
npm run start:all
-
Open the Application
Open your browser and go to
http://localhost:3000
.
If u need Run Docker Containers
Make sure you have Docker and Docker Compose installed. Then run the following command:
docker-compose up --build
- frontend: Directory containing frontend code in React.
- services: Directory containing microservices code (comments, ratings, etc.).
- docker-compose.yml: Docker Compose configuration file.
- Dockerfile: Dockerfile for creating containers.
- POST /register: Register a new user.
- POST /login: Authenticate a user.
- GET /profile: Get profile information.
- GET /posts/:id: Get post information by ID.
- GET /posts/search: Search posts by title.
- GET /posts/search/user: Search posts by username.
- GET /posts/:postId/rating: Get rating of a post.
- POST /posts/:postId/like: Like a post.
- POST /posts/:postId/dislike: Dislike a post.
- GET /posts/:postId/comments: Get comments for a post.
- POST /posts/:postId/comments: Add a new comment to a post.
- GET /users: Get all users.
- DELETE /posts/:id: Delete post by ID.
The search functionality allows users to search for posts by title and for posts by username.
-
Search by Title: Users can search for posts by entering keywords in the search bar. The search will return posts whose titles contain the entered keywords.
-
Search by Username: Users can search for posts by entering a username preceded by an "@" symbol in the search bar. The search will return posts created by users whose usernames contain the entered substring.
To perform administrative actions, users need to be authenticated and have an "admin" role.
To set up the "admin" user, edit the .env
file and replace the following variables:
ADMIN_USERNAME=admin
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=123098
This project is licensed under the MIT License. See the LICENSE file for details.