Modular NestJS backend for a social feed system with organized architecture and security features.
Note
This project is a Learning Project. Some features may be overkill or included only for practice (e.g., Redis, extra security layers, or more complex patterns).
- TypeORM β ORM for Entities, Relations, and Migrations.
- PostgreSQL β Relational database for structured, linked data.
- Redis (Caching) β In-memory layer to speed up repeated queries.
- Indexing & Unique Indexes β Improves read performance and prevents duplicates.
- Rate Limiting (Throttler) β Prevents excessive requests and abuse.
- Recaptcha Validation (v3) β Blocks bot activity on sensitive endpoints.
- Normalization β Ensures clean input and consistent database structure.
- Modular Architecture β Each feature is isolated into its own NestJS module.
- Authentication β Secure login and signup workflow using JWT tokens and opaque tokens.
- Access & Refresh Tokens β Short-lived access tokens and long-lived refresh tokens for session continuity.
- Partial User Search β Search for users by matching parts of their username.
- Public User Data β Exposes non-sensitive profile information.
- Posts β Create, view, and manage user-generated posts.
- Comments β Commenting system with parentβchild relations(self referencing).
- Follow System β Basic social graph to follow/unfollow users.
- Like System (Posts/Comments) β Unique like actions enforced with unique indexes.
- Identicon Avatars/PFPs β Auto-generated profile images for new users.
- Rate Limiting β App-wide throttling to prevent request flooding.
- Helmet Protection β Adds secure HTTP headers for baseline protection.
- GZip Compression β Reduces response size for faster delivery.
- Swagger Docs β Auto-generated API documentation.
- Recaptcha (v3) β Server-side validation to block automated signups/logins.
- Cursor-Based Pagination β Efficient, scalable feed pagination.
- Role-Based Access Control (RBAC) β Restricts actions based on user roles.
- Ban/Unban Users β Administrative controls for platform moderation.
- View History β View previously liked posts and past comments.
- Post Visibility β Allow public and private posts
- Redis Caching β Speeds up frequently accessed pages like user profiles or feeds.
-
Clone the repository:
git clone https://github.com/EcjTn/text-feed-api.git cd text-feed-api -
Setup environment variables(env.example provided)
-
Run docker compose:
docker compose up -d --build