Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neerajkumar161/twitty
A Twitter like application (Proof of Concept) in Nestjs, Google OAuth and Postgres
https://github.com/neerajkumar161/twitty
class-transformer-validator nestjs nodejs postgres proof-of-concept typeorm typescript
Last synced: 17 days ago
JSON representation
A Twitter like application (Proof of Concept) in Nestjs, Google OAuth and Postgres
- Host: GitHub
- URL: https://github.com/neerajkumar161/twitty
- Owner: neerajkumar161
- License: mit
- Created: 2024-08-22T05:17:28.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-24T12:59:08.000Z (4 months ago)
- Last Synced: 2024-10-31T04:41:55.906Z (2 months ago)
- Topics: class-transformer-validator, nestjs, nodejs, postgres, proof-of-concept, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
A progressive Node.js framework for building efficient and scalable server-side applications.
# Twitty (Proof of Concept)
## Overview
This project is a backend service for a small Twitter-like application built using NestJS. The application focuses on core features like user management, tweet functionalities, following system, and timeline generation, using PostgreSQL for data storage and Google OAuth for authentication.
## Features
- **User Management**:
- User registration and login using Firebase.
- Profile management.
- Follow and unfollow functionality.
- **Tweet Functionality**:
- Post tweets (text only).
- Like and retweet tweets.- **Timeline**:
- View timeline with tweets from followed users.
- Pagination support.- **API Documentation**:
- Documentation generated using Swagger.## Tech Stack
- **Backend Framework**: [NestJS](https://nestjs.com/)
- **Database**: [PostgreSQL](https://www.postgresql.org/) with [TypeORM](https://typeorm.io/)
- **Authentication**: [Google Auth](https://cloud.google.com/nodejs/docs/reference/google-auth-library/latest)
- **API Documentation**: [Swagger](https://swagger.io/)## Getting Started
### Prerequisites
- Node.js (v18+)
- PostgreSQL
- Google Cloud Project### Installation
1. **Clone the Repository**:
```bash
git clone https://github.com/neerajkumar161/twitty
cd twitty
```2. **Install Dependencies**:
```bash
npm install
```3. **Set Up Environment Variables**:
Create a `.env` file in the root of the project and add the following variables:```env
DB_HOST =
DB_USERNAME =
DB_PASSWORD =
DB_NAME =
GOOGLE_CLIENT_ID =
JWT_SCRET_KEY =
```4. Configure Google OAuth Concent Screen. [**Read More**](https://developers.google.com/workspace/guides/configure-oauth-consent). Also don't forget to Add Test users in order to login using Google.
5. **Build the Application**:
```bash
npm run build
npm run start:prod
```6. **Start the Application in Development**:
```bash
npm run start:dev
```7. **Access API Documentation**:
Open your browser and navigate to `http://localhost:3000/api` to view the Swagger documentation.## Project Structure
```plaintext
├── src
│ ├── auth // Contains authentication logic using Google Auth.
│ ├── decorators // Swagger API combined decorator
│ ├── filters // Nestjs Filters for Error handling
│ ├── timeline // Generates user timelines with pagination.
│ ├── tweet // Manages tweet creation, liking, and retweeting.
│ ├── user // Handles user management, including profiles and following system
│ └── main.ts
├── test
├── .env
├── .gitignore
├── nest-cli.json
├── package.json
└── README.md
```## API Endpoints
### Authentication
- **POST** `/auth/google`: Register or Login a user using Google.
### User Profile and follow
- **GET** `/users/profile`: Fetch a user’s profile.
- **POST** `/users/follow/:userId`: Follow a user.
- **DELETE** `/users/unfollow/:userId`: Unfollow a user.### Tweet Functionality
- **POST** `/tweets`: Post a new tweet.
- **POST** `/tweets/like`: Like a tweet.
- **POST** `/tweets/retweet`: Retweet a tweet.### User Timeline
- **GET** `/timeline`: Get the current user’s timeline with pagination.
## Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
For any inquiries, please contact via [**Email**](mailto:[email protected]).