The Non-Profit News and Announcement Management System is a web-based platform designed to facilitate the dynamic entry and management of News and Announcements for a non-profit organization's website. It provides separate admin interfaces for managing content and user interfaces for viewing news and announcements.
- News Management: Create, update, and delete news items.
- Announcements Management: Create, update, and delete announcements.
- News Listing: View a list of news articles with detailed pop-up views.
- Announcements Listing: View a list of announcements.
- Secure login and role-based access control through Keycloak.
- Programming Language: Java
- Backend Framework: Spring Boot
- ORM: Hibernate
- Database: PostgreSQL
- Frontend Framework: Vue
- Authentication: Keycloak
- Containerization: Docker, Docker Compose
- Docker and Docker Compose installed on your machine.
- Git installed for version control.
- Maven installed.
-
Clone the Repository
git clone https://github.com/osmntahir/EventPortal.git cd EventPortal
-
Build the Backend
Before running Docker Compose, build the backend application.
cd context-manager mvn clean install -DskipTests cd ..
-
Build and Run the Containers
Use Docker Compose to build and start all the services defined in the
docker-compose.yml
file.docker-compose up --build
If you want to run the containers in the background (detached mode), use the following command:
docker-compose up --build -d
This command will:
- Pull the necessary Docker images for PostgreSQL and Keycloak.
- Build the
context-manager
,admin-panel
, anduser-ui
services from their respective Dockerfiles. - Start all services and set up the network.
-
Accessing the Application
Once all containers are up and running, you can access the different parts of the application using the following URLs:
- Admin Panel: http://localhost:3000
- User Interface: http://localhost:3001
- Keycloak Admin Console: http://localhost:9090
- Context Manager API: http://localhost:8080
-
Initial Setup for Keycloak
The Keycloak server initializes by importing the configuration files located in the
keycloak-import
directory. These files are:cmv_realm-realm.json
cmv_realm-users-0.json
These configurations set up the necessary realms, clients, roles, and an admin user with the Admin role.
-
Login Credentials:
- Username:
admin
- Password:
admin123
- Username:
-
Accessing Keycloak Admin Console:
- Navigate to http://localhost:9090
- Log in using the admin credentials above.
- From here, you can manage realms, clients, roles, and users as needed.
-
Accessing Admin Panel:
- Use the same admin credentials (
admin
/admin123
) to log into the Admin Panel at http://localhost:3000.
- Use the same admin credentials (
-
Database Initialization
The PostgreSQL container initializes the database using the scripts located in the
./postgres-init
directory. Ensure that any necessary SQL scripts are placed in this directory for proper database setup.
-
Accessing Admin Features:
- Navigate to http://localhost:3000.
- Log in using the admin credentials:
- Username:
admin
- Password:
admin123
- Username:
-
Managing News:
- Add new news items by providing the subject, content, validity date, and news link.
- Edit or remove existing news items as needed.
-
Managing Announcements:
- Add new announcements by providing the subject, content, validity date, and uploading an image.
- Edit or remove existing announcements as needed.
-
Viewing News:
- Navigate to http://localhost:3001.
- Browse through the list of news articles.
- Click on a news item to view detailed information in a popup.
-
Viewing Announcements:
- Browse through the list of announcements.
- View announcement details, including images.
-
Accessing Keycloak Admin Console:
- Navigate to http://localhost:9090.
- Log in using the admin credentials:
- Username:
admin
- Password:
admin123
- Username:
-
Managing Realms, Clients, and Roles:
- From the admin console, you can create and manage realms, clients, and roles.
- Assign roles to users as needed to control access within the application.
The project employs the Single Table Inheritance design pattern for managing different types of events (e.g., News
and Announcement
) under a common base class (Event
). In this pattern:
- Base Class (
Event
): BothNews
andAnnouncement
inherit common properties fromEvent
. - Discriminator Column: The
@DiscriminatorValue
annotation is used to store a type identifier (NEWS
orANNOUNCEMENT
) in the database, which differentiates between the two types. - Inheritance: This allows shared functionality to be handled in the base
Event
class, whileNews
andAnnouncement
entities can have additional fields (newsLink
forNews
andimagePath
forAnnouncement
).
All event types are stored in a single database table, reducing complexity while allowing for flexibility in managing different types of events.
For any inquiries or feedback, please contact ozdemirosmantahir@gmail.com.
Coding is a journey, not a destination. 🚀 Thanks for making it to the end, and remember, the real magic happens in the debugging!