# LinkedIn-Based Church Management System A comprehensive church management system built with FastAPI that incorporates LinkedIn-style networking features to help church members connect, share updates, and manage events. ## Features ### Authentication & User Management - User registration and login with JWT tokens - Profile management with bio, position, and contact information - User search functionality - Profile pictures and personal information ### LinkedIn-Style Networking - Send connection requests to other church members - Accept/reject connection requests - View connections and networking activity - Professional-style member profiles ### Social Features - Create and share posts (announcements, prayer requests, general updates) - Like and comment on posts - Community feed with chronological posts - Different post types (announcements, prayer requests) ### Event Management - Create and manage church events - Event registration system with capacity limits - Public/private event settings - Event attendance tracking - RSVP management ### Church Member Management - Member directory with search capabilities - Role-based permissions (admin/member) - Member profile management - Contact information management ## Tech Stack - **Backend**: FastAPI (Python) - **Database**: SQLite with SQLAlchemy ORM - **Authentication**: JWT tokens with bcrypt password hashing - **Migrations**: Alembic - **Validation**: Pydantic - **Code Quality**: Ruff for linting ## Installation & Setup 1. **Clone the repository** ```bash git clone cd linkedinbasedchurchmanagementsystem-7j9m7d ``` 2. **Install dependencies** ```bash pip install -r requirements.txt ``` 3. **Set up environment variables** Create a `.env` file in the root directory with: ``` SECRET_KEY=your-secret-key-here-change-this-in-production ``` 4. **Run database migrations** ```bash alembic upgrade head ``` 5. **Start the application** ```bash uvicorn main:app --reload ``` The application will be available at `http://localhost:8000` ## API Documentation Once the server is running, you can access: - **Swagger UI**: `http://localhost:8000/docs` - **ReDoc**: `http://localhost:8000/redoc` - **OpenAPI JSON**: `http://localhost:8000/openapi.json` ## API Endpoints ### Authentication - `POST /auth/register` - Register a new user - `POST /auth/token` - Login and get access token - `GET /auth/me` - Get current user information ### Users - `GET /users/` - Get all users (paginated) - `GET /users/{user_id}` - Get specific user - `PUT /users/me` - Update current user profile - `GET /users/search/{query}` - Search users ### Posts - `POST /posts/` - Create a new post - `GET /posts/` - Get all posts (paginated) - `GET /posts/{post_id}` - Get specific post - `PUT /posts/{post_id}` - Update post - `DELETE /posts/{post_id}` - Delete post - `POST /posts/{post_id}/like` - Like a post - `DELETE /posts/{post_id}/like` - Unlike a post - `POST /posts/{post_id}/comments` - Add comment to post - `GET /posts/{post_id}/comments` - Get post comments ### Events - `POST /events/` - Create a new event - `GET /events/` - Get all events - `GET /events/{event_id}` - Get specific event - `PUT /events/{event_id}` - Update event - `DELETE /events/{event_id}` - Delete event - `POST /events/{event_id}/register` - Register for event - `DELETE /events/{event_id}/register` - Unregister from event - `GET /events/{event_id}/registrations` - Get event registrations ### Connections - `POST /connections/` - Send connection request - `GET /connections/sent` - Get sent connection requests - `GET /connections/received` - Get received connection requests - `GET /connections/accepted` - Get accepted connections - `PUT /connections/{connection_id}` - Accept/reject connection - `DELETE /connections/{connection_id}` - Remove connection ## Environment Variables The following environment variables need to be set: - `SECRET_KEY` - JWT secret key for token generation (required) - `PORT` - Port number for the application (default: 8000) ## Database The application uses SQLite as the database, stored at `/app/storage/db/db.sqlite`. The database schema includes: - **Users**: User accounts with profiles and authentication - **Connections**: LinkedIn-style connections between users - **Posts**: Social media style posts with likes and comments - **Events**: Church events with registration management - **Comments**: Comments on posts - **Likes**: Like system for posts - **Event Registrations**: Event attendance tracking ## Health Check The application provides a health check endpoint at `/health` that returns the service status and version information. ## Development ### Running with Auto-reload ```bash uvicorn main:app --reload --host 0.0.0.0 --port 8000 ``` ### Code Quality The project uses Ruff for code formatting and linting: ```bash ruff check . ruff format . ``` ### Database Migrations To create a new migration: ```bash alembic revision --autogenerate -m "Description of changes" ``` To apply migrations: ```bash alembic upgrade head ``` ## Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Run tests and linting 5. Submit a pull request ## License This project is licensed under the MIT License.