/toktik

Very basic Tiktok clone in Python (FastAPI & SQLAlchemy)

Primary LanguagePython

tiktok_team_a

Basic Tiktok clone

  • Visitors can only view Post
  • User can login or signup
  • User can create Posts and Comments
  • Post has Comments




Documentation




API

Dependencies

Install

conda create --name toktik
conda activate toktik
conda install python=3.10 pip
pip install uvicorn fastapi==0.100.0 SQLAlchemy pyjwt passlib psycopg2 hashlib
conda activate toktik
uvicorn api.src.main:app --reload

Endpoints


  • User
GET /user/:id (get 1 User)
Parameters
name type data type description
id required int user_id
Responses
http code content-type response
200 application/json User
404 application/json User does not exist
POST /user/register (get an auth token)
Parameters
name type data type description
username required str Username
email required str Valid email adress
password required str Password
Responses
http code content-type response
200 application/json ""[token]
DELETE /user/delete/:id (Delete a User)
Responses
http code content-type response
200 application/json User
404 application/json User does not exist
GET /user/token (get 1 User, by their token)
Parameters
name type data type description
token required str User token
Responses
http code content-type response
200 application/json User
404 application/json User does not exist
GET /user/list (get all Users)
Responses
http code content-type response
200 application/json User
POST /user/login (login)
Parameters
name type data type description
email required str Email
password required str Password
Responses
http code content-type response
200 application/json User
PATCH /user/:id (Partially update an existing User)
Parameters
name type data type description
username optional str Username
email optional str Email
password optional str Password
token optional str Token
Responses
http code content-type response
200 application/json User
404 application/json User does not exist

  • Post
GET /post/:id (get 1 Post)
Parameters
name type data type description
id required int post_id
Responses
http code content-type response
200 application/json Post
404 application/json Post does not exist
GET /post/random (get a random Post)
Responses
http code content-type response
200 application/json Post
GET /post/list (get all Posts)
Responses
http code content-type response
200 application/json Post
POST /post/create (create a new Post)
Parameters
name type data type description
title required str Title of Post
description optional str Description of Post
video_url required str URL of embedded video
user_id required int ID of author
Responses
http code content-type response
200 application/json Post
DELETE /post/delete/:id (Delete a Post)
Responses
http code content-type response
200 application/json Post
404 application/json Post does not exist
PATCH /post/update/:id (Partially update an existing Post)
Parameters
name type data type description
title optional str Title of Post
description optional str Description of Post
Responses
http code content-type response
200 application/json Post
404 application/json Post does not exist

  • Comment
GET /comment/:id (get 1 Comment)
Parameters
name type data type description
id required int comment_id
Responses
http code content-type response
200 application/json Comment
404 application/json Comment does not exist
GET /comment/list (get all Comments)
Responses
http code content-type response
200 application/json Comment
COMMENT /comment/create (create a new Comment)
Parameters
name type data type description
content required str Actual comment
author_id required str Author of comment
post_id required str Post the comment was made on
Responses
http code content-type response
200 application/json Comment
DELETE /comment/delete/:id (Delete a Comment)
Responses
http code content-type response
200 application/json Comment
404 application/json Comment does not exist
PATCH /comment/update/:id (Partially update an existing Comment)
Parameters
name type data type description
content optional str Actual comment
Responses
http code content-type response
200 application/json Comment
404 application/json Comment does not exist




Client

Dependencies

Run

Just open index.html and you're good to go