ChatApp is a messaging application designed with support for real-time communication between users. Currently, the authentication part of the backend API is implemented using Go (Golang).
- Features
- Technologies Used
- Installation
- Environment Variables
- Running the Application
- API Endpoints
- Contributing
- License
- User registration and login
- JWT-based authentication
- Backend: Go (Golang)
- Framework: Echo - High-performance, extensible, minimalist web framework for Go
- Database: PostgreSQL
- Authentication: JWT (JSON Web Token)
- Encryption: bcrypt for password hashing
- Environment Management: dotenv
-
Go (Golang) 1.16 or higher
-
PostgreSQL
-
Make sure you have installed the necessary Go packages:
- goose
- wire
go mod tidy
Create a .env
file with the following configuration:
APP_NAME=chat_app
APP_ENV=development
APP_PORT=7700
DB_HOST=localhost
DB_PORT=5433
DB_USERNAME=db_user_name
DB_PASSWORD=db_password
DB_DATABASE_NAME=db_name
SWAGGER_HOST_URL=api_url
SWAGGER_HOST_SCHEME=https
SWAGGER_USERNAME=user_name
SWAGGER_PASSWORD=password
AUTH_SECRET=secret
AUTH_EXPIRY_PERIOD=90
-
Ensure PostgreSQL is running and the necessary environment variables are set.
-
Run the application using:
go run main.go
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /api/v1/users |
Register a new user | No |
POST | /api/v1/users/login |
User login | No |
GET | /api/v1/users/{username} |
Get user details by username | Yes |
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch-name
). - Make your changes and commit them (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch-name
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.