Teneno API

A official api for teneno application

Dev.to Github Email LinkedIn

Preview

Description

  • The purpose of Teneno webapp is create a new network platform where everyone can sharing their feels, thinks or experiences together
  • Make an easily life with Teneno
  • Practice Backend skills and improve programming thinking

Features

Admin Auth
✅ Get list all users ✅ Signup
✅ Get user profile by id ✅ Signin
✅ Update user profile ✅ Verify recaptcha
✅ Delete user by user-id ✅ Signout
✅ Refresh access-token
✅ Update password
OAuth Files
✅ Google signin ✅ Upload single file (avatar, cover)
✅ Facebook signin ✅ Upload multi files
✅ Github signin ✅ Upload array-field files (post, sample_image)
Users Posts
✅ Get public user by user-id or username ✅ Create a new post
✅ Find user account by email ✅ Get all posts of user by user-id
✅ Get user profile by id ✅ Match a new category with new post
✅ Update user profile ✅ Get a post by post-id
✅ Delete user-profile by email & password ✅ Delete a post by post-id
✅ Reaction to post
✅ Get all comments of post
✅ Add a new comment to post
✅ Update a comment of post
✅ Delete a comment of post
Conversations Chats
✅ Create new conversation ✅ Join conversation by conversation-id
✅ Get all conversations of user ✅ Get all messages in conversation
✅ Get one conversation information has current user ✅ Create new messages
✅ Update members to current conversation ✅ Update message by message-id
✅ Update conversation information (name, description, avatar) ✅ Delete messages by message-id
✅ Delete admin out of current conversation by creator
✅ Delete conversation by creator
✅ Change users role in current conversation

Structure

Architecture

Diagram database

  • Relational diagram

Relational diagram

Plugins & Dependencies

  • Nodejs framework for building efficient and scalable server-side applications
  • Nest framework TypeScript starter repository
  • Prisma query builder and auto-generated schema with types tailored
  • CORS connect middleware that can be used to enable CORS with various options
  • Swagger describe definition format and design document APIs at scale
  • Bcrypt a library to help you hash passwords
  • Crypto-js a JavaScript library of crypto standards
  • JWT decode, verify and generate access tokens
  • Class-validator use of decorator and non-decorator to perform validation
  • Class-transformer transform plain object to some instance of class and versa and serialize / deserialize object based on criteria
  • Passport compatible authentication requests middleware for Node.js
  • Cookies-Parser middleware parsing of cookies in Nodejs and Expressjs.
  • Multer upload file data form in Expressjs
  • Morgan HTTP request logger middleware for Node.js
  • Cookie-parser Parse Cookie header and signed cookie support
  • Helmet secure Express apps by setting various HTTP headers
  • Compression compress response bodies for all request
  • Read-Eval-Print-Loop (REPL) takes - executes single user inputs, and returns the result to the user, interactive environment, inspect dependency graph and call methods on providers - controllers directly from terminal
  • Serve Static serve static content like a Single Page Application (SPA)
  • Compodoc Generate project documentation
  • Webpack hot-reload auto recompile the entire project each time a change occurs
  • gRPC support to run in any environment across data centers based on the concept of defining a service in terms of functions (methods) that called remotely
  • Session store information about the user across multiple requests, which is particularly useful for MVC applications.
  • Versioning allows you to have different versions of your controllers or individual routes running within the same application.
  • CSRF (Cross-site request forgery) type of malicious exploit of a website where unauthorized commands are transmitted from a user that the web application trusts
  • rate-limiting protect your application from brute-force attacks

Conventions & Tools

References & Tips

Example templates

Setup Prisma

# Installation
npm install prisma@latest @prisma/client
# Init prisma
npx prisma init

# turn database schema into a Prisma schema
npm run prisma:pull

# generate the Prisma Client
npm run prisma:generate

# Create env and migrate db
npm run prisma:migrate

# Sync migrate change to db
npm run prisma:push
# Open prisma studio
npm run prisma:studio

Running with local

# Intall dependencies
$ npm install
# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Running with Docker

# Pull image
$ docker pull thuongtruong1009/teneno-api:latest
# Start container
$ docker-compose up

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Support

Teneno is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

❤️ Support me

We are looking for sponsors to join us to have better community reach and impact.

MOMO Buy Me a Coffee at ko-fi.com

📰 License

results matching ""

    No results matching ""