API for imaginary social network
This is a RESTful API for an imaginary social network.
├── src
├── .env.sample
├── .eslintrc
├── .gitignore
├── .prettierrc
├── docker-compose.yml
├── Makefile
├── nest-cli.json
├── package.json
├── README.md
└── tsconfig.build.json
└── tsconfig.json
User Model
- id
- userName
- fullName
- password
- refreshToken
- dateOfBirth
- profilePictureUrl
- createdAt
- updatedAt
- posts (Post model)
Post Model
- id
- title
- content
- picture
- author (User model)
- authorId (Foreign key from User model)
- createdAt
- updatedAt
- deletedAt
The diagrammatic representation of the models can be found here
- Sign up
- Sign in
- Create tokens ( A refresh token when access token get expired)
- Logout
- Get a single user (userMe)
- Fetch users with pagination
- Change of password
- Update user information
- Upload user profile picture
- Create post with either with picture upload or not
- Fetch posts with pagination
- Fetch single post
- Fetch posts by author
- Soft delete post bt author
- Update post by author with either with picture upload or not
- Search functionality for post and user
This project uses Nest.js It has the following dependencies:
- GraphQl
- Postgres Database
- Prisma
- ESLint & Prettier
- Ensure you have NodeJS installed by entering
node -v
on your terminal If you don't have NodeJS installed, go to the NodeJS Website, and follow the download instructions
You can clone this project directly using this command:
git clone https://github.com/AbonyiXavier/social-network-Apis
- After cloning the repository, create a
.env
file from.env.sample
and set your local.env.
variable(s).
cp .env.sample .env
- Install the dependencies
yarn install
- You can run the server using
yarn run start:dev
How to run all tests locally
make install
- Installs dependencies.make dev
- Run the servermake build
make gen-migrate
- Generate migration.make lint
- Lint code.make studio
- Opens up a prisma virtual interface for your databasemake up
- Start up your app from docker-compose.yml file
-
Public API documentation of this project is available on postman docs
-
To test create post with picture or update post with picture or upload single profilePictureUrl for user, kindly download Altair GraphQL Client.
-
The authentication flow could have email notification sent to users upon signing up for verification to avoid bot users registering to our system.
-
Forget and reset password should be considered as part of the authentication flow.
-
The cloudStorageService such as (e.g., AWS S3, Google Cloud Storage, cloudinary) should be responsible for handling the file upload (The post picture or user profilePictureUrl) to a cloud storage system instead of saving them into a local directory (./src/upload).
-
Implement Role and Permission privileges.
-
We could have more models such Comment, Like, Follower or Friendship with extended feature of implementing mentions, hashTags, liking a post and comments and been able to follow a user.
This project is under the MIT LICENSE