Skip to content

Louis2602/TFCM

Repository files navigation

Getting Started

Install all npm packages:

npm install

Development

To get *.env file, contact ttlam.dev@gmail.com. Do not leak, share or spam any of these api keys, because it is charged money.

Run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Note that this ngrok server is free, so that it can only be run by 1 person.

If you want to create any new schemas for the database, create it in src/db/schema.ts

Remember, after create or modify a schema, must generate a migration script and push it to the database to update

Generate migration script:

npm run generate

Push migration script:

npm run push

Run Drizzle Studio to view the database:

npm run studio

For more commands, take a look in package.json file and in the drizzle-orm documentation pages.

Testing

For unit tests, we use jest. Put all your unit tests code into the folder: /tests

Deployment Guide

Step 1: Clone this repository

git clone https://github.com/Louis2602/tfcm

Step 2: Push Your Code to a Git Repository

Your code needs to be in a Git repository on GitHub, GitLab, or Bitbucket.

  1. Initialize a Git repository (if you haven’t already).

    git init
  2. Add your files to the repository.

    git add .
  3. Commit your changes.

    git commit -m "Initial commit"
  4. Add the remote repository.

    git remote add origin <your-repository-url>
  5. Push your code to the repository.

    git push -u origin main

Step 3: Connect Your Repository to Vercel

  1. Login to Vercel: Go to Vercel and log in with your account.

  2. Import Project:

    • Click on the “New Project” button on your dashboard.
    • Select the Git provider where your repository is hosted (GitHub, GitLab, or Bitbucket).
    • Authorize Vercel to access your repositories if prompted.
  3. Select Repository: Choose the repository containing your Next.js app.

  4. Configure Project:

    • Ensure the project name and root directory are correct.
    • Vercel will automatically detect it’s a Next.js project and apply the appropriate settings.
  5. Environment Variables: If your application requires environment variables, add them in the "Environment Variables" section.

NODE_ENV=development

# OpenAI
OPENAI_API_KEY=sk-proj-example

# App URL
APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_URL="http://localhost:3000"

POSTGRES_URL=example

# Stripe
STRIPE_API_KEY=example
STRIPE_WEBHOOK_SECRET=example
STRIPE_PLAN_100=example
STRIPE_PLAN_200=example
STRIPE_PLAN_350=example
STRIPE_PLAN_500=example

BLOB_READ_WRITE_TOKEN="vercel_blob_example"

GOOGLE_TRENDS_REALTIME_URL="https://serpapi.com/search.json"
GOOGLE_TRENDS_API_KEY=example

Step 4: Deploy Your Next.js App

  1. Deploy: Click on the “Deploy” button. Vercel will start the deployment process.
  2. Monitor Deployment: You can monitor the build logs to see the progress of your deployment.
  3. Access Your App: Once the deployment is complete, Vercel will provide you with a URL to access your deployed application.

Step 5: Configure Domain (Optional)

If you have a custom domain, you can configure it in Vercel:

  1. Add Domain:

    • Go to the “Domains” tab in your project settings.
    • Click on “Add Domain” and enter your custom domain.
  2. Update DNS Settings:

    • Update your domain's DNS settings to point to Vercel. This usually involves adding an A record or CNAME record as instructed by Vercel.
  3. Verify Domain: Once DNS settings are updated, click on “Verify” in Vercel to confirm the domain setup.

Step 6: Configure Continuous Deployment (Optional)

For continuous deployment, you can configure Vercel to automatically deploy your app whenever you push changes to the main branch.

  1. Branch Settings:

    • Go to the “Git” tab in your project settings.
    • Ensure the main branch is selected for automatic deployments.
  2. Deploy Hooks (Optional):

    • You can set up deploy hooks to trigger deployments from other sources or scripts.

About

Tool for Content Management

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages