Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
KrinalSojitra21 committed Jun 6, 2024
0 parents commit 18c1518
Show file tree
Hide file tree
Showing 511 changed files with 51,329 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts


#firebase
.firebase

serviceAccount.json
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<div align='center'>

# [Witit: AI powered social media](https://witit-dcc9d.web.app/)

</div>

![Witit](https://imgur.com/ghWBCmq.png)

Witit - AI powered social media app that helps creators make more money by renting out their ai models. It has offline storage for images + feed. I have implemented offline storage with the package called Isar with the custom built syncing solution to mongoDB.

![Witit](https://imgur.com/5ArWUcw.png)

# Features ✨

- **Generate Stunning AI-Generated Images:** Craft stunning images that captivate and inspire with advanced AI technology.

- **Create Engaging Posts:** Craft compelling posts that resonate with your audience and spark conversation.

- **Level Up Your AI:** Explore the limitless possibilities of AI to unleash your creativity.

- **Advanced Creation Tools:** Access a suite of powerful tools to elevate your content creation game.

- **Earn Cash From Your AI:** Monetize your AI-generated creations and turn your passion into profit.

- **AI Integration Into Posts:** Embed AI into your posts.

- **Subscription Includes 20 Photo Creations a Day:** Create up to 20 breathtaking AI-enhanced photos every day.

- **Get Verified:** Earn the prestigious verification badge to showcase user credibility.

- **Create and View Content With Fewer Restrictions:** Enjoy more freedom in content creation and viewing.

- **Transform Ordinary Photos Into Extraordinary AI Masterpieces:** Create AI photos in various photography styles.

- **Bank Account Linking & Withdraw Funds:** Connect your bank account for transactions and Withdraw funds hassle-free with intuitive withdrawal options.

- **Verify Identity:** Confirm your identity for security.

- **Renew Plan:** Renew your subscription plan seamlessly without any hassle.

- **Send and Receive Credits Seamlessly:** Exchange credits with other users.

- **Organize With Member Circles:** Create and manage member circles for streamlined collaboration and communication.

- **Engage With Powerful Messaging:** Stay connected with fellow creators through robust messaging features.

- **Master Advanced Recreation Settings:** Adjust settings for photo recreations.

## Tech Stack 💻

**Witit is built using the following technologies:**

- **Next.js:** Witit is built using the Next.js framework, which provides a seamless and efficient development experience for creating modern web applications.

- **Tailwind CSS:** The user interface of Witit is designed using Tailwind CSS, a highly customizable CSS framework that enables rapid and responsive UI development.

- **OpenAI API:** Witit leverages the OpenAI API to access state-of-the-art language models that power the core paraphrasing and grammar correction functionality.

- **Firebase:** Firebase is utilized in the application to provide instant notifications, ensuring real-time communication and updates for users.

- **API Integration:** API Integration is implemented for interaction with external services, enabling data sharing and functionality enhancement for a comprehensive, interconnected user experience.

- **Stripe Integration:** Stripe is used in Witit for handling online payments, providing a secure and efficient way to process transactions within the application.

- **Socket.IO:** Socket.IO enables real-time, bidirectional and event-based communication between the browser and the server.

- **TypeScript:** Witit is developed using TypeScript, a statically typed superset of JavaScript that enhances code quality, maintainability, and developer productivity.

- **Next Auth:** Next Auth is utilized for implementing user authentication and authorization in Witit, allowing users to securely access the application and their personalized data.

- **React:** The user interface components of Witit are built using React, a popular JavaScript library for building interactive and reusable UI components.

- **HTML:** Witit utilizes HTML for structuring and presenting the application's content, ensuring a semantic and accessible web experience.

<div align='center'>

### Click [here](https://witit-dcc9d.web.app/) to visit the live demo website.

</div>
39 changes: 39 additions & 0 deletions api/activity/getActivity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Axios } from "../axiosConfig";
import { Activity } from "@/types/activity";

type Props = {
user_id: string;
limit: number;
lastDocId?: string;
};

type Res = {
status: number;
data: Activity[];
error: any;
};

export const getActivity = async ({ limit, lastDocId, user_id }: Props) => {
let res: Res = { status: 0, data: [], error: "" };

try {
const result = await Axios.get("/activity", {
params: {
limit,
...(lastDocId && { lastDocId }),
},
headers: {
user_id,
},
});

res.status = 200;
res.data = result.data.data;
} catch (error: any) {
console.log(error);
res.status = error.response.status;
res.error = error.response.data.error;
}

return res;
};
32 changes: 32 additions & 0 deletions api/activity/readActivity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Axios } from "../axiosConfig";
import { Activity } from "@/types/activity";

type Props = {
user_id: string;
};

type Res = {
status: number;
data: Activity[];
error: any;
};

export const readActivity = async ({ user_id }: Props) => {
let res: Res = { status: 0, data: [], error: "" };

try {
const result = await Axios.post("/activity/read", {
headers: {
user_id,
},
});

res.status = 200;
res.data = result.data.data;
} catch (error: any) {
res.status = error.response.status;
res.error = error.response.data.error;
}

return res;
};
37 changes: 37 additions & 0 deletions api/ai/deleteAiModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Axios } from "../axiosConfig";

type Props = {
user_id: string | undefined;
modelId: number | string;
};
type Res = {
status: number;
data: string | null;
error: any;
};

const deleteAiModel = async ({ user_id, modelId }: Props) => {
const res: Res = {
status: 0,
data: null,
error: "",
};
try {
const result = await Axios.delete("/ai/model", {
params: {
modelId,
},
headers: {
user_id,
},
});
res.status = 200;
res.data = result.data.message;
} catch (error: any) {
res.status = 200;
res.error = error;
}
return res;
};

export default deleteAiModel;
66 changes: 66 additions & 0 deletions api/ai/generateTextToImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Axios } from "../axiosConfig";
import {
AiCharges,
CreationSettings,
GetAiGeneration,
RecreationSettings,
SuperShoot,
} from "@/types/ai";

type GenerationBody = {
prompt: string;
modelId: number | string;
numberOfGenerations: number;
superShoot: boolean;
negativePrompt: string[];
creationSettings: CreationSettings;
recreationSettings: RecreationSettings | null;
postId: string | null;
image: string | null;
};

type Props = {
user_id: string;
generationBody: GenerationBody;
};

type Res = {
status: number;
data: GetAiGeneration | null;
error: any;
};

export const generateAiImage = async ({ user_id, generationBody }: Props) => {
let res: Res = {
status: 0,
data: null,
error: "",
};

try {
const result = await Axios.post(
"/ai/runpod/generate",
{
...generationBody,
...(!generationBody.image && {
image: undefined,
postId: undefined,
recreationSettings: undefined,
}),
},
{
headers: {
user_id,
},
}
);

res.status = 200;
res.data = result.data.data;
} catch (error: any) {
res.status = error.response.status;
res.error = error.response.data.error;
}

return res;
};
42 changes: 42 additions & 0 deletions api/ai/getAiModelApplications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Axios } from "../axiosConfig";
import { AiApplication } from "@/types/ai";

type Props = {
user_id: string;
limit?: number;
lastDocId?: string;
};

type Res = {
status: number;
data: AiApplication[];
error: any;
};

export const getAiModelApplications = async ({
user_id,
limit,
lastDocId,
}: Props) => {
let res: Res = { status: 0, data: [], error: "" };

try {
const result = await Axios.get("/user/ai_model/applications", {
params: {
limit,
...(lastDocId && { lastDocId }),
},
headers: {
user_id,
},
});

res.status = 200;
res.data = result.data.data;
} catch (error: any) {
res.status = error.response.status;
res.error = error.response.data.error;
}

return res;
};
42 changes: 42 additions & 0 deletions api/ai/getBaseAndSelfModels.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Post } from "@/types/post";
import { Axios } from "../axiosConfig";
import { GetAiGeneration, BaseModel, UserModel } from "@/types/ai";

type Props = {
user_id: string;
};

type Data = {
baseModelList: BaseModel[];
userModelList: UserModel[];
};

type Res = {
status: number;
data: Data;
error: any;
};

export const getBaseAndSelfModels = async ({ user_id }: Props) => {
let res: Res = {
status: 0,
data: { baseModelList: [], userModelList: [] },
error: "",
};

try {
const result = await Axios.get("/ai/models", {
headers: {
user_id,
},
});

res.status = 200;
res.data = result.data.data;
} catch (error: any) {
res.status = error.response.status;
res.error = error.response.data.error;
}

return res;
};
Loading

0 comments on commit 18c1518

Please sign in to comment.