https://github.com/muhammadabyaz/student-mgt-system
A simple API for Student Management System
https://github.com/muhammadabyaz/student-mgt-system
air docker-compose gin-gonic go godotenv golang postgresql
Last synced: 2 months ago
JSON representation
A simple API for Student Management System
- Host: GitHub
- URL: https://github.com/muhammadabyaz/student-mgt-system
- Owner: MuhammadAbyaz
- Created: 2025-01-01T12:37:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-04T15:40:03.000Z (over 1 year ago)
- Last Synced: 2025-02-22T21:29:38.728Z (over 1 year ago)
- Topics: air, docker-compose, gin-gonic, go, godotenv, golang, postgresql
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Student Management System API
An API for managing student records, built using Golang and the Gin web framework. This system includes functionalities for creating, updating, deleting, and retrieving student data, as well as login and registration for administrators.
## Features
- **CRUD Operations for Students**:
- Create new student records
- Retrieve individual student records
- Retrieve all student records
- Update existing student records
- Delete student records
- **Admin Authentication**:
- Register as an admin
- Login as an admin
## Technologies Used
- **Backend**: Golang (Gin framework)
- **Database**: PostgreSQL
- **Authentication**: JWT
## Installation and Setup
1. Clone the repository:
```bash
git clone git@github.com:MuhammadAbyaz/student-mgt-system.git
cd student-management-system
```
2. Install dependencies:
```bash
go mod tidy
```
3. Configure the database:
- Update the database configuration in `.env` file.
4. Run the docker container:
```bash
docker compose up -d
```
5. Run the application:
```bash
go run main.go
```
6. The server will start at `http://localhost:8080/api/v1`.
## API Endpoints
### Student Routes
1. **Create Student**
- `POST /student`
- **Description**: Add a new student.
- **Request Body**:
```json
{
"firstName": "John",
"lastName": "Doe"
}
```
2. **Get Student by ID**
- `GET /student/:id`
- **Description**: Retrieve a specific student by their ID.
3. **Get All Students**
- `GET /students`
- **Description**: Retrieve all student records.
4. **Update Student**
- `PATCH /student/:id`
- **Description**: Update a student's details.
- **Request Body**:
```json
{
"firstName": "Jane",
"lastName": "Dane"
}
```
5. **Delete Student**
- `DELETE /student/:id`
- **Description**: Delete a student by their ID.
### Admin Routes
1. **Register Admin**
- `POST /auth/register`
- **Description**: Register a new admin.
- **Request Body**:
```json
{
"name": "admin",
"email": "admin@example.com",
"password": "xyzpassword"
}
```
2. **Login Admin**
- `POST /auth/login`
- **Description**: Login as an admin.
- **Request Body**:
```json
{
"email": "admin@example.com",
"password": "xyzpassword"
}
```
## Author
Muhammad Abyaz Khalid