Skip to content

AparatExpressGraphQLTS is a TypeScript-based GraphQL web service designed to mimic the functionality of the popular video sharing platform Aparat (similar to YouTube). This project utilizes the Express framework to create a custom GraphQL API, providing users with features for uploading, viewing, and interacting with videos and other media content.

License

Notifications You must be signed in to change notification settings

BaseMax/AparatExpressGraphQLTS

Repository files navigation

AparatExpressGraphQLTS - GraphQL Web Service for Aparat Clone

AparatExpressGraphQLTS is a TypeScript-based GraphQL web service designed to mimic the functionality of the popular video sharing platform Aparat (similar to YouTube). This project utilizes the Express framework to create a custom GraphQL API, providing users with features for uploading, viewing, and interacting with videos and other media content.

Features

  • User authentication and authorization.
  • Video upload, storage, and retrieval.
  • Video categorization and tagging.
  • User interactions such as likes, comments, and views.
  • Comprehensive search functionality.
  • GraphQL API for flexible and efficient data retrieval.

Technologies Used

  • Node.js: A JavaScript runtime built on Chrome's V8 JavaScript engine.
  • Express: A fast, unopinionated web framework for Node.js.
  • GraphQL: A query language for APIs that enables more efficient and flexible data retrieval.
  • TypeScript: A typed superset of JavaScript that compiles to plain JavaScript.
  • Prisma: A NoSQL database for storing and managing data.

Prerequisites

Before you begin, ensure you have met the following requirements:

Demo

Demo

Demo

Demo

Demo

Demo

Demo

Demo

Demo

Demo

Demo

Demo

Getting Started

Clone the repository:

git clone https://github.com/BaseMax/AparatExpressGraphQLTS.git

Or download the source code from: AparatExpressGraphQLTS

Install dependencies:

cd AparatExpressGraphQLTS
npm install

Set up your environment variables by creating a .env file at the root of the project. You can use the provided .env.example as a template.

Start the server:

npm run start:dev

The GraphQL playground will be accessible at http://localhost:3000/graphql by default. You can explore and test the API using this interface.

Project Structure

The project structure is organized as follows:

.
├── LICENSE
├── package.json
├── package-lock.json
├── prisma
│   ├── migrations
│   │   ├── 20230817132514_init
│   │   │   └── migration.sql
│   │   └── migration_lock.toml
│   └── schema.prisma
├── public
│   └── uploads
├── README.md
├── src
│   ├── app.ts
│   ├── config
│   ├── controllers
│   │   └── videoController.ts
│   ├── errors
│   │   ├── http-error.ts
│   │   └── validation.ts
│   ├── inputs
│   │   ├── createCommentInput.ts
│   │   ├── createVideoInput.ts
│   │   ├── loginInput.ts
│   │   └── registerInput.ts
│   ├── interfaces
│   │   ├── contextType.ts
│   │   └── jwtPayload.ts
│   ├── jwt
│   │   └── jwtStrategy.ts
│   ├── middlewares
│   │   └── authMiddleware.ts
│   ├── multer
│   │   └── storage.ts
│   ├── object-types
│   │   ├── auth.ts
│   │   ├── entity
│   │   │   ├── category-entity.ts
│   │   │   ├── comment-entity.ts
│   │   │   ├── user-entity.ts
│   │   │   └── video-entity.ts
│   │   └── status-result.ts
│   ├── resolvers
│   │   ├── AuthResolver.ts
│   │   ├── CommentResolver.ts
│   │   ├── HelloWorldResolver.ts
│   │   ├── LikeResolver.ts
│   │   ├── playListResolver.ts
│   │   ├── tagResolver.ts
│   │   ├── TagResolver.ts
│   │   ├── UserResolver.ts
│   │   └── VideoResolver.ts
│   ├── routes
│   │   ├── index.ts
│   │   └── video.ts
│   ├── services
│   │   ├── AuthService.ts
│   │   ├── UserService.ts
│   │   └── VideoService.ts
│   └── types
└── tsconfig.json

GraphQL

Query/Mutation Name Description Example
getUser Get user details by ID. getUser(id: ID!): User
getVideo Get video details by ID. getVideo(id: ID!): Video
listVideos List videos with optional filtering and sorting. listVideos(filter: VideoFilter, sort: VideoSort, pagination: PaginationInput): [Video]
searchVideos Search videos by title or description. searchVideos(query: String!): [Video]
listCategories List all video categories. listCategories: [Category]
listComments List comments for a video. listComments(videoId: ID!): [Comment]
getUserLikes List videos liked by a user. getUserLikes(userId: ID!): [Video]
getPlaylist Get playlist details by ID. getPlaylist(id: ID!): Playlist
listPlaylists List playlists with optional filtering. listPlaylists(filter: PlaylistFilter): [Playlist]
createPlaylist Create a new playlist. createPlaylist(input: CreatePlaylistInput!): Playlist
updatePlaylist Update playlist details by ID. updatePlaylist(id: ID!, input: UpdatePlaylistInput!): Playlist
deletePlaylist Delete a playlist by ID. deletePlaylist(id: ID!): Boolean
addVideoToPlaylist Add a video to a playlist. addVideoToPlaylist(playlistId: ID!, videoId: ID!): Playlist
removeVideoFromPlaylist Remove a video from a playlist. removeVideoFromPlaylist(playlistId: ID!, videoId: ID!): Playlist
getTag Get tag details by ID. getTag(id: ID!): Tag
listTags List all available tags. listTags: [Tag]
getAuthor Get author details by ID. getAuthor(id: ID!): Author
listAuthors List all authors. listAuthors: [Author]
getCategory Get category details by ID. getCategory(id: ID!): Category
getComment Get comment details by ID. getComment(id: ID!): Comment
createUser Create a new user. createUser(input: CreateUserInput!): User
updateUser Update user details by ID. updateUser(id: ID!, input: UpdateUserInput!): User
deleteUser Delete a user by ID. deleteUser(id: ID!): Boolean
uploadVideo Upload a new video. uploadVideo(input: UploadVideoInput!): Video
updateVideo Update video details by ID. updateVideo(id: ID!, input: UpdateVideoInput!): Video
deleteVideo Delete a video by ID. deleteVideo(id: ID!): Boolean
addLike Add a like to a video. addLike(videoId: ID!): Video
removeLike Remove a like from a video. removeLike(videoId: ID!): Video
addComment Add a comment to a video. addComment(videoId: ID!, input: CommentInput!): Comment
updateComment Update a comment by ID. updateComment(id: ID!, input: UpdateCommentInput!): Comment
deleteComment Delete a comment by ID. deleteComment(id: ID!): Boolean
createPlaylist Create a new playlist. createPlaylist(input: CreatePlaylistInput!): Playlist
updatePlaylist Update playlist details by ID. updatePlaylist(id: ID!, input: UpdatePlaylistInput!): Playlist
deletePlaylist Delete a playlist by ID. deletePlaylist(id: ID!): Boolean
addVideoToPlaylist Add a video to a playlist. addVideoToPlaylist(playlistId: ID!, videoId: ID!): Playlist
removeVideoFromPlaylist Remove a video from a playlist. removeVideoFromPlaylist(playlistId: ID!, videoId: ID!): Playlist
createTag Create a new tag. createTag(input: CreateTagInput!): Tag
updateTag Update tag details by ID. updateTag(id: ID!, input: UpdateTagInput!): Tag
deleteTag Delete a tag by ID. deleteTag(id: ID!): Boolean
createAuthor Create a new author. createAuthor(input: CreateAuthorInput!): Author
updateAuthor Update author details by ID. updateAuthor(id: ID!, input: UpdateAuthorInput!): Author
deleteAuthor Delete an author by ID. deleteAuthor(id: ID!): Boolean
createCategory Create a new category. createCategory(input: CreateCategoryInput!): Category
updateCategory Update category details by ID. updateCategory(id: ID!, input: UpdateCategoryInput!): Category
deleteCategory Delete a category by ID. deleteCategory(id: ID!): Boolean
createComment Create a new comment. createComment(input: CreateCommentInput!): Comment
updateComment Update comment details by ID. updateComment(id: ID!, input: UpdateCommentInput!): Comment
deleteComment Delete a comment by ID. deleteComment(id: ID!): Boolean

Contributing

Contributions are welcome! If you find any issues or would like to suggest improvements, please open an issue or submit a pull request.

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

Copyright 2023, Max Base

About

AparatExpressGraphQLTS is a TypeScript-based GraphQL web service designed to mimic the functionality of the popular video sharing platform Aparat (similar to YouTube). This project utilizes the Express framework to create a custom GraphQL API, providing users with features for uploading, viewing, and interacting with videos and other media content.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published