TrueFeedback is a Next.js application built with TypeScript that allows users to send and receive anonymous messages. It also leverages the OpenAI ChatGPT API to generate random questions or prompts to encourage interaction. The application features two main interfaces: one for viewing received messages and another for sending anonymous messages. Authentication is implemented using NextAuth.
- Features
- Tech Stack
- Getting Started
- Configuration
- Project Structure
- API Endpoints
- Contributing
- License
- Anonymous Messaging: Users can send and receive anonymous messages.
- ChatGPT Integration: Generates random prompts or questions using the OpenAI API.
- Authentication: Secure user authentication with NextAuth.
- User Interfaces: Separate interfaces for sending and receiving messages.
- Responsive Design: Optimized for both desktop and mobile devices.
- Frontend: Next.js, TypeScript
- Authentication: NextAuth.js
- API: OpenAI ChatGPT API
- Styling: CSS Modules / Styled Components / Tailwind CSS (choose your preferred method)
- Database: (e.g., MongoDB, PostgreSQL - specify based on your setup)
Before you begin, ensure you have the following installed:
- Node.js (>= 14.x)
- npm or yarn
- A MongoDB or PostgreSQL database instance (if using a database)
- An OpenAI API key
-
Clone the repository:
git clone https://github.com/prabal-verma/truefeedback.git cd truefeedback
-
Install dependencies:
npm install
# or
yarn install
Create a .env.local
file in the root directory and add the following environment variables:
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_nextauth_secret
OPENAI_API_KEY=your_openai_api_key
DATABASE_URL=your_database_url
Run the development server:
npm run dev
# or
yarn dev
- NextAuth: Configure providers, callbacks, and other options in
pages/api/auth/[...nextauth].ts
. - OpenAI API: Use the OpenAI API key in your server-side logic to generate random messages.
truefeedback/
βββ components/
β βββ MessageList.tsx
β βββ SendMessageForm.tsx
β βββ ...
βββ pages/
β βββ api/
β β βββ auth/
β β β βββ [...nextauth].ts
β β βββ messages.ts
β β βββ ...
β βββ index.tsx
β βββ send.tsx
β βββ ...
βββ public/
β βββ ...
βββ styles/
β βββ globals.css
β βββ ...
βββ utils/
β βββ openai.ts
β βββ ...
βββ .env.local
βββ next.config.js
βββ package.json
βββ README.md
- GET /api/messages: Fetch received messages for the authenticated user.
- POST /api/messages: Send a new anonymous message.
- GET /api/generate-prompt: Generate a random prompt using ChatGPT.
We welcome contributions! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes with clear messages.
- Push your changes to your fork.
- Create a pull request to the main branch of the original repository.
This project is licensed under the MIT License. See the LICENSE file for details.