Skip to content

Commit 0d4cdd6

Browse files
committed
searxng service in docker-compose. Also, updated dependencies and configurations such as TailwindCSS and Next.js bundling.
Took 1 minute
1 parent 5d7010d commit 0d4cdd6

14 files changed

+3015
-386
lines changed

.cursorrules

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Project-specific rules for Cursor AI
2+
[project]
3+
name = "wishonia"
4+
framework = "next.js"
5+
version = "15.0"
6+
router = "app"
7+
style = "tailwind"
8+
typescript = true
9+
10+
# Define the project's architecture and conventions
11+
[architecture]
12+
# All page.tsx files are server components by default
13+
server_components = [
14+
"app/**/page.tsx",
15+
"app/**/layout.tsx",
16+
"app/**/template.tsx"
17+
]
18+
client_components = [
19+
"components/**/*.tsx",
20+
"app/**/components/*.tsx"
21+
]
22+
hooks = ["lib/hooks/**/*.ts"]
23+
utils = ["lib/**/*.ts"]
24+
config = ["config/**/*.ts"]
25+
types = ["types/**/*.ts"]
26+
27+
# Authentication patterns
28+
[auth]
29+
server_components = """
30+
Import server-side auth:
31+
import { getServerSession } from "next-auth/next"
32+
33+
Usage:
34+
const session = await getServerSession()
35+
"""
36+
37+
client_components = """
38+
Import client-side auth:
39+
import { useSession } from 'next-auth/react'
40+
41+
Usage:
42+
const { data: session } = useSession()
43+
"""
44+
45+
# Next.js App Router conventions
46+
[next]
47+
routing = """
48+
- Use app directory for all routes
49+
- page.tsx files are automatically server components
50+
- loading.tsx for loading states
51+
- error.tsx for error handling
52+
- layout.tsx for shared layouts
53+
"""
54+
55+
server_components = """
56+
IMPORTANT: Never add 'use client' to page.tsx files
57+
- Pages are server components by default
58+
- Create separate client components for interactive elements
59+
- Import client components into server components as needed
60+
"""
61+
62+
data_fetching = """
63+
- Use server components for data fetching when possible
64+
- Leverage React Server Components for better performance
65+
- Use route handlers (route.ts) for API endpoints
66+
"""
67+
68+
# Database and type safety
69+
[database]
70+
prisma = """
71+
- Import types directly from Prisma client
72+
- Use Prisma-generated types for all database operations
73+
- Always prefer schema.prisma types over creating new ones
74+
Example:
75+
import { Post, User } from '@prisma/client'
76+
"""
77+
78+
# Component structure rules
79+
[components]
80+
organization = """
81+
For interactive features:
82+
1. Create client component in separate file:
83+
components/MyInteractiveComponent.tsx
84+
2. Import into server component page:
85+
app/my-page/page.tsx
86+
"""
87+
88+
client_components = """
89+
Only add 'use client' when component:
90+
- Uses hooks (useState, useEffect, etc.)
91+
- Needs browser APIs
92+
- Has user interactions
93+
- Uses client-side libraries
94+
95+
Example location:
96+
app/my-feature/components/InteractiveComponent.tsx
97+
"""
98+
99+
server_components = """
100+
Keep pages as server components:
101+
- No 'use client' directive
102+
- No hooks or browser APIs
103+
- Import client components as needed
104+
- Fetch data server-side when possible
105+
106+
Example:
107+
app/my-feature/page.tsx
108+
"""
109+
110+
# File patterns to ignore
111+
[ignore]
112+
patterns = [
113+
"node_modules",
114+
".next",
115+
"build",
116+
"dist",
117+
"public/assets",
118+
".git"
119+
]
120+
121+
# Custom rules for the project
122+
[rules]
123+
component_patterns = """
124+
✅ DO:
125+
- Keep pages as server components
126+
- Create separate client components for interactivity
127+
- Use Prisma types for database operations
128+
- Use proper auth imports based on component type
129+
- Use self-documenting names for variables, fields, and models
130+
- Always choose the simplest implementation to minimize complexity
131+
132+
❌ DON'T:
133+
- Add 'use client' to page.tsx
134+
- Mix client and server code in same component
135+
- Use wrong auth import for component type
136+
- Create new types when Prisma schema types are available
137+
- Use cryptic or abbreviated names
138+
"""
139+
140+
auth_patterns = """
141+
Server Components:
142+
import { getServerSession } from "next-auth/next"
143+
const session = await getServerSession()
144+
145+
Client Components:
146+
import { useSession } from 'next-auth/react'
147+
const { data: session } = useSession()
148+
"""
149+
150+
# Type safety rules
151+
types = """
152+
- Use TypeScript strict mode
153+
- Import Prisma types directly from @prisma/client
154+
- Create interfaces for component props
155+
- Avoid 'any' type
156+
"""
157+
158+
# Performance guidelines
159+
performance = """
160+
- Keep pages as server components when possible
161+
- Use client components only when necessary
162+
- Implement proper code splitting
163+
- Use React Suspense boundaries wisely
164+
"""
165+
166+
# Testing guidelines
167+
[testing]
168+
jest = """
169+
- Always set @jest-environment node at the top of test files
170+
- Write tests that can safely run against production (so don't delete data or do cleanup)
171+
- Use real implementations instead of mocks where possible
172+
Example test header:
173+
/**
174+
* @jest-environment node
175+
*/
176+
"""

.env.example

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,103 @@ LANGCHAIN_CALLBACKS_BACKGROUND=true
4646
# Get key from https://www.perplexity.ai/settings/api
4747
PERPLEXITY_API_KEY="KEY_HERE"
4848
# Get key from https://dashboard.exa.ai/api-keys
49-
EXASEARCH_API_KEY="KEY_HERE"
49+
EXASEARCH_API_KEY="KEY_HERE"
50+
51+
KV_URL=
52+
KV_REST_API_URL=
53+
KV_REST_API_TOKEN=
54+
KV_REST_API_READ_ONLY_TOKEN=
55+
56+
# For saving wordpress posts
57+
WORDPRESS_URL=
58+
WORDPRESS_USERNAME=
59+
WORDPRESS_PASSWORD=
60+
61+
GOOGLE_API_KEY=
62+
GOOGLE_CUSTOM_SEARCH_CX=
63+
64+
LANGFUSE_SECRET_KEY="sk-lf-..."
65+
LANGFUSE_PUBLIC_KEY="pk-lf-..."
66+
LANGFUSE_BASEURL="https://cloud.langfuse.com"
67+
68+
AWS_ACCESS_KEY_ID=your-test-access-key
69+
AWS_SECRET_ACCESS_KEY=your-test-secret-key
70+
AWS_REGION=your-test-region
71+
AWS_BUCKET=your-test-bucket
72+
73+
# Tavily API Key retrieved here: https://app.tavily.com/home
74+
TAVILY_API_KEY=[YOUR_TAVILY_API_KEY]
75+
76+
# Redis Configuration
77+
USE_LOCAL_REDIS=false
78+
LOCAL_REDIS_URL=redis://localhost:6379 # or redis://redis:6379 if you're using docker compose
79+
80+
# Upstash Redis URL and Token retrieved here: https://console.upstash.com/redis
81+
UPSTASH_REDIS_REST_URL=[YOUR_UPSTASH_REDIS_REST_URL]
82+
UPSTASH_REDIS_REST_TOKEN=[YOUR_UPSTASH_REDIS_REST_TOKEN]
83+
84+
# SearXNG Configuration
85+
SEARXNG_API_URL=http://localhost:8080 # Replace with your local SearXNG API URL or docker http://searxng:8080
86+
SEARCH_API=tavily # use searxng, tavily or exa
87+
SEARXNG_SECRET="" # generate a secret key e.g. openssl rand -base64 32
88+
SEARXNG_PORT=8080 # default port
89+
SEARXNG_BIND_ADDRESS=0.0.0.0 # default address
90+
SEARXNG_IMAGE_PROXY=true # enable image proxy
91+
SEARXNG_LIMITER=false # can be enabled to limit the number of requests per IP address
92+
SEARXNG_DEFAULT_DEPTH=basic # Set to 'basic' or 'advanced', only affects SearXNG searches
93+
SEARXNG_MAX_RESULTS=50 # Maximum number of results to return from SearXNG
94+
SEARXNG_ENGINES=google,bing,duckduckgo,wikipedia # Search engines to use
95+
SEARXNG_TIME_RANGE=None # Time range for search results: day, week, month, year, or None (for all time)
96+
SEARXNG_SAFESEARCH=0 # Safe search setting: 0 (off), 1 (moderate), 2 (strict)
97+
98+
# Optional
99+
# The settings below can be used optionally as needed.
100+
101+
# Used to set the base URL path for OpenAI API requests.
102+
# If you need to set a BASE URL, uncomment and set the following:
103+
# OPENAI_API_BASE=
104+
105+
# Used to set the model for OpenAI API requests.
106+
# If not set, the default is gpt-4o.
107+
# OPENAI_API_MODEL=gpt-4o-mini
108+
109+
# Azure OpenAI API key retrieved here: https://oai.azure.com/resource/deployments/
110+
# AZURE_API_KEY=
111+
112+
# The resource name is used in the assembled URL: https://{resourceName}.openai.azure.com/openai/deployments/{modelId}{path}.
113+
# AZURE_RESOURCE_NAME=
114+
115+
# Used to set the deployment name for Azure OpenAI API requests.
116+
# If not set, the default is gpt-4o.
117+
# AZURE_DEPLOYMENT_NAME=
118+
119+
# If you want to use Google Generative AI instead of OpenAI, enable the following settings.
120+
# Google Generative AI API key retrieved here: https://aistudio.google.com/app/apikey
121+
# GOOGLE_GENERATIVE_AI_API_KEY=[YOUR_GOOGLE_GENERATIVE_AI_API_KEY]
122+
123+
# If you want to use Anthropic instead of OpenAI, enable the following settings.
124+
# ANTHROPIC_API_KEY=[YOUR_ANTHROPIC_API_KEY]
125+
126+
# If you want to use Groq, enable the following variables. only available for tool use compatible models.
127+
# GROQ_API_KEY=[YOUR_GROQ_API_KEY]
128+
# GROQ_API_MODEL=[YOUR_GROQ_API_MODEL] # e.g. llama3-groq-8b-8192-tool-use-preview
129+
130+
# If you want to use Ollama, enable the following variables.
131+
# OLLAMA_MODEL=[YOUR_OLLAMA_MODEL] # The main model to use. Currently compatible: qwen2.5
132+
# OLLAMA_BASE_URL=[YOUR_OLLAMA_URL] # The base URL to use. e.g. http://localhost:11434
133+
134+
# enable the share feature
135+
# If you enable this feature, separate account management implementation is required.
136+
# ENABLE_SHARE=true
137+
138+
# enable the video search tool
139+
# Serper API Key retrieved here: https://serper.dev/api-key
140+
# SERPER_API_KEY=[YOUR_SERPER_API_KEY]
141+
142+
# If you want to use Jina instead of Tavily for retrieve tool, enable the following variables.
143+
# JINA_API_KEY=[YOUR_JINA_API_KEY]
144+
145+
#NEXT_PUBLIC_BASE_URL=http://localhost:3000
146+
147+
DFDA_CLIENT_ID=
148+
DFDA_CLIENT_SECRET=

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ next-env.d.ts
5656

5757
.trigger
5858
/.vscode
59+
60+
.vercel
61+
/.env.vercel
62+
/run_anthropic_docker.ps1
63+
/logs

docker-compose.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,25 @@ services:
1414
- .postgres:/var/lib/postgresql/data
1515

1616
redis:
17-
image: redis:latest
17+
image: redis:alpine
1818
container_name: redis
1919
restart: unless-stopped
2020
volumes:
21-
- .redis:/data
21+
- redis_data:/data
22+
command: redis-server --appendonly yes
2223
ports:
2324
- "6379:6379"
25+
26+
searxng:
27+
image: searxng/searxng
28+
ports:
29+
- '${SEARXNG_PORT:-8080}:8080'
30+
env_file: .env.local # can remove if you want to use env variables or in settings.yml
31+
volumes:
32+
- ./searxng-limiter.toml:/etc/searxng/limiter.toml
33+
- ./searxng-settings.yml:/etc/searxng/settings.yml
34+
- searxng_data:/data
35+
36+
volumes:
37+
redis_data:
38+
searxng_data:

env.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ interface Env {
55
NODE_ENV: string
66
// Add other environment variables as needed
77
NEXT_PUBLIC_APP_URL: string
8+
NEXT_PUBLIC_SITE_NAME: string
9+
NEXT_PUBLIC_SITE_DESCRIPTION: string
10+
NEXT_PUBLIC_SITE_AUTHOR: string
11+
NEXT_PUBLIC_SITE_KEYWORDS: string
12+
NEXT_PUBLIC_SITE_OG_IMAGE: string
813
NEXT_PUBLIC_API_KEY: string
914
NEXT_PUBLIC_API_URL: string
15+
NEXT_PUBLIC_DEFAULT_HOMEPAGE: string
16+
NEXT_PUBLIC_DEFAULT_AFTER_LOGIN_PATH: string
1017
NEXTAUTH_URL: string
1118
NEXTAUTH_SECRET: string
1219
GOOGLE_CLIENT_ID: string

env.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ export const env = createEnv({
1515
},
1616
client: {
1717
NEXT_PUBLIC_APP_URL: z.string().min(1),
18+
NEXT_PUBLIC_SITE_NAME: z.string().optional(),
19+
NEXT_PUBLIC_SITE_DESCRIPTION: z.string().optional(),
20+
NEXT_PUBLIC_SITE_AUTHOR: z.string().optional(),
21+
NEXT_PUBLIC_SITE_KEYWORDS: z.string().optional(),
22+
NEXT_PUBLIC_SITE_OG_IMAGE: z.string().url().optional(),
23+
NEXT_PUBLIC_DEFAULT_HOMEPAGE: z.string().optional(),
24+
NEXT_PUBLIC_DEFAULT_AFTER_LOGIN_PATH: z.string().optional(),
1825
},
1926
runtimeEnv: {
2027
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
@@ -25,7 +32,14 @@ export const env = createEnv({
2532
GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET,
2633
DATABASE_URL: process.env.DATABASE_URL,
2734
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
35+
NEXT_PUBLIC_SITE_NAME: process.env.NEXT_PUBLIC_SITE_NAME,
36+
NEXT_PUBLIC_SITE_DESCRIPTION: process.env.NEXT_PUBLIC_SITE_DESCRIPTION,
37+
NEXT_PUBLIC_SITE_AUTHOR: process.env.NEXT_PUBLIC_SITE_AUTHOR,
38+
NEXT_PUBLIC_SITE_KEYWORDS: process.env.NEXT_PUBLIC_SITE_KEYWORDS,
39+
NEXT_PUBLIC_SITE_OG_IMAGE: process.env.NEXT_PUBLIC_SITE_OG_IMAGE,
2840
EMAIL_SERVER: process.env.EMAIL_SERVER,
2941
EMAIL_FROM: process.env.EMAIL_FROM,
42+
NEXT_PUBLIC_DEFAULT_HOMEPAGE: process.env.NEXT_PUBLIC_DEFAULT_HOMEPAGE,
43+
NEXT_PUBLIC_DEFAULT_AFTER_LOGIN_PATH: process.env.NEXT_PUBLIC_DEFAULT_AFTER_LOGIN_PATH,
3044
},
3145
})

instrumentation.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { registerOTel } from "@vercel/otel";
2+
import { LangfuseExporter } from "langfuse-vercel";
3+
14
export async function register() {
25
if (!process.env.SENTRY_AUTH_TOKEN) {
36
console.debug(
@@ -12,4 +15,8 @@ export async function register() {
1215
if (process.env.NEXT_RUNTIME === "edge") {
1316
await import("./sentry.edge.config")
1417
}
18+
registerOTel({
19+
serviceName: "langfuse-vercel-ai-nextjs-example",
20+
traceExporter: new LangfuseExporter(),
21+
});
1522
}

0 commit comments

Comments
 (0)