Skip to content

Feature | Add documentation of caddy control #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b69cc22
feat: add permission management components and hooks
mukezhz Apr 7, 2025
2b728ba
feat: implement permission seeding and enhance permission checks in u…
mukezhz Apr 8, 2025
a82954c
Refactor user authentication and permissions handling
mukezhz Apr 8, 2025
f728213
fix: clean up unused console log in permission seeding function
mukezhz Apr 8, 2025
26313bc
Merge branch 'main' into feat/authorization
mukezhz Apr 9, 2025
937a12d
refactor: streamline user authentication and permissions handling acr…
mukezhz Apr 9, 2025
8930196
fix: remove unnecessary console log for user permissions in route han…
mukezhz Apr 9, 2025
f61ebad
refactor: enhance user and permission handling across services and hooks
mukezhz Apr 9, 2025
41b9c2a
feat: add redirect URL functionality for domain management
mukezhz Apr 9, 2025
fb48710
feat: include redirect URL in domain check results
mukezhz Apr 9, 2025
e2fc548
fix: standardize error handling in domain addition route
mukezhz Apr 9, 2025
5503653
Update src/app/api/domain/add/route.ts
mukezhz Apr 9, 2025
f71a28b
Update src/components/proxies/add-proxy-dialog.tsx
mukezhz Apr 9, 2025
7f2a96a
fix: update port handling in domain addition and proxy dialog
mukezhz Apr 9, 2025
e3ea9e6
fix: trim whitespace for redirect domain validation
mukezhz Apr 9, 2025
008b62e
feat: add basic api docs template in existing project
mukezhz Apr 18, 2025
8bfbd28
feat: add comprehensive API documentation for authentication, endpoin…
mukezhz Apr 18, 2025
f5ed05a
feat: update sidebar and TOC for API documentation, remove unused cus…
mukezhz Apr 18, 2025
de06566
fix: update proxy description for clarity in the UI
mukezhz Apr 18, 2025
9cb9574
refactor: remove unused imports from docs layout and page components
mukezhz Apr 18, 2025
5244e72
refactor: remove unused variable assignment in delete user confirmati…
mukezhz Apr 18, 2025
796a683
refactor: remove deprecated dependencies and update version specifica…
mukezhz Apr 18, 2025
99ed0d6
feat: add next-contentlayer dependency to package.json and pnpm-lock.…
mukezhz Apr 18, 2025
8b2fa3b
fix: update import paths for contentlayer to reflect new structure
mukezhz Apr 18, 2025
33fd0ca
fix: correct dev script in package.json and add missing comma in next…
mukezhz Apr 18, 2025
2bb17ce
fix: adjust padding and margin in header component for improved layout
mukezhz Apr 18, 2025
8349d50
fix: update layout styles in Docs and Home components for better resp…
mukezhz Apr 18, 2025
78a3694
fix: add author URLs to meta configuration for better attribution
mukezhz Apr 29, 2025
34f0aa8
fix: add versions support to domain schema and related templates for …
mukezhz Apr 29, 2025
00fd74f
fix: add advanced settings for HTTP protocol versions in AddProxyDial…
mukezhz Apr 29, 2025
87b3bf0
fix: update Dockerfile and add docker-compose configuration for impro…
mukezhz Apr 29, 2025
6aef12e
fix: ensure OpenSSL is installed in the production stage of the Docke…
mukezhz Apr 29, 2025
11369d4
fix: make SERVICE_NAME optional in environment variables schema
mukezhz Apr 29, 2025
47ba953
fix: update permission checks and resource actions for user and API m…
mukezhz Apr 30, 2025
64e66ae
fix: update permission checks to use OR logic for user access in rout…
mukezhz Apr 30, 2025
2e979fe
fix: remove debug logging from permission check in auth store
mukezhz Apr 30, 2025
3805e21
fix: update permission checks to use user_management permissions acro…
mukezhz Apr 30, 2025
6846412
fix: enhance permission checks to support view/manage logic across us…
mukezhz Apr 30, 2025
0c5a2de
fix: update permission checks to use proxy_management permissions and…
mukezhz Apr 30, 2025
1bfe7af
fix: refactor permission checks to utilize Resources for improved rea…
mukezhz Apr 30, 2025
21f13eb
feat: add redirection dialog and integrate with proxies actions
mukezhz Apr 30, 2025
4bb596b
fix: update ProxyRecord to make incomingAddress clickable with proper…
mukezhz Apr 30, 2025
b507828
fix: update ProxiesActions layout for better responsiveness and enhan…
mukezhz Apr 30, 2025
f766759
fix: enhance documentation with emojis for better readability and cla…
mukezhz May 1, 2025
3bc1ca9
fix: update documentation to clarify API endpoints and improve descri…
mukezhz May 1, 2025
aee5445
Refactor API routes and services for user management
mukezhz May 1, 2025
01be8be
chore: update feature section of readme
mukezhz May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ db/
.idea/
docker-compose.yml
Dockerfile
.next
.next
.contentlayer/
docker-compose.*
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ next-env.d.ts
db
caddy_config
caddy_data
test
test
.contentlayer
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.14.0-alpine3.20 AS base
FROM node:jod-bookworm-slim AS base
RUN npm install -g pnpm
WORKDIR /app

Expand All @@ -10,18 +10,22 @@ RUN pnpm install --frozen-lockfile
# build stage
FROM base AS builder
WORKDIR /app
RUN apt-get update -y && apt-get install -y openssl
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN pnpx prisma generate
RUN pnpm run build:content
RUN pnpm build

# production stage
FROM base AS runner
WORKDIR /app
RUN apt-get update -y && apt-get install -y openssl
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.contentlayer ./.contentlayer
COPY --from=builder /app/start.sh ./start.sh
RUN chmod +x /app/start.sh

Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DOCKER_REPO := ttl.sh
DOCKER_IMAGE := caddycontrol
DOCKER_TAG := 5m

push:
docker build --platform linux/amd64 -t $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG) .
docker push $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)

.PHONY: push
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This project was born out of the need to build a custom domain service with auto
- [x] Rest API Access
- [x] Proxy management dashboard
- [x] API Keys management dashboard
- [ ] Domain redirection option
- [ ] Multi user support
- [x] Domain redirection option
- [x] Multi user support

## Screenshots

Expand Down
48 changes: 48 additions & 0 deletions config/meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export const meta = {
metadataBase: new URL('https://caddy-control.vercel.app'),
title: 'Caddy Control - Documentation',
description:
'Open-source solution for domain routing and proxy management! 🚀',
authors: [
{ name: 'Mukesh Kumar Chaudhary', url: 'https://mukesh.name.np' },
{ name: 'Avash Ghimire', url: 'https://avashghimire.com.np' }
],
keywords: [
'Caddy Control',
'Next.js',
'Proxy',
'Caddy',
'Documentation',
],
publisher: 'Mukesh Kumar Chaudhary',
creator: 'Mukesh Kumar Chaudhary',
openGraph: {
type: 'website',
title: 'Caddy Control - Documentation',
description:
'Open-source solution for domain routing and proxy management! 🚀',
images: [
{
url: '/logo.png',
width: 1200,
height: 630,
alt: 'Caddy Control Documentation',
},
],
},
twitter: {
card: 'summary_large_image',
title: 'Caddy Control - Documentation',
description:
'Open-source solution for domain routing and proxy management! 🚀',
images: ['/logo.png'],
creator: '@mukezhz',
},
alternates: {
canonical: 'https://caddy-control.vercel.app',
},
robots: 'index, follow',
hreflang: {
en: 'https://caddy-control.vercel.app',
},
};
42 changes: 42 additions & 0 deletions config/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { BookOpen, Code, FileCode, Rocket } from 'lucide-react';

export const sidebarNav = [
{
title: 'Getting Started',
icon: <Rocket className="h-5 w-5" />,
defaultOpen: true,
pages: [
{
title: 'Introduction',
href: '/docs/getting-started/introduction',
},
{
title: 'Installation',
href: '/docs/getting-started/installation',
},
{
title: 'Quick Start',
href: '/docs/getting-started/quick-start',
},
],
},
{
title: 'API Reference',
icon: <Code className="h-5 w-5" />,
defaultOpen: true,
pages: [
{
title: 'Overview',
href: '/docs/api/overview',
},
{
title: 'Authentication',
href: '/docs/api/authentication',
},
{
title: 'Endpoints',
href: '/docs/api/endpoints',
},
],
},
];
150 changes: 150 additions & 0 deletions config/toc.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
type TocPage = {
title: string;
href: string;
};

type TocSection = {
title: string;
href: string;
pages?: TocPage[];
};

type TocData = {
[key: string]: TocSection[];
};

// TOC Data for Caddy Control documentation
export const TocData: TocData = {
'getting-started/introduction': [
{
title: 'Welcome to Caddy Control',
href: '/docs/getting-started/introduction#welcome-to-caddy-control',
pages: [
{
title: 'Why Choose Caddy Control',
href: '/docs/getting-started/introduction#why-choose-caddy-control',
},
{
title: 'Features',
href: '/docs/getting-started/introduction#features',
},
{
title: 'Technologies',
href: '/docs/getting-started/introduction#technologies-behind-caddy-control',
},
],
},
],
'getting-started/installation': [
{
title: 'Installation Guide',
href: '/docs/getting-started/installation#installation-guide',
pages: [
{
title: 'Local Development Setup',
href: '/docs/getting-started/installation#local-development-setup',
},
{
title: 'Production Deployment with Docker',
href: '/docs/getting-started/installation#production-deployment-with-docker',
},
{
title: 'Verifying Your Installation',
href: '/docs/getting-started/installation#verifying-your-installation',
},
],
},
],
'getting-started/quick-start': [
{
title: 'Quick Start Guide',
href: '/docs/getting-started/quick-start#quick-start-guide',
pages: [
{
title: 'Managing Domains',
href: '/docs/getting-started/quick-start#managing-domains',
},
{
title: 'Next Steps',
href: '/docs/getting-started/quick-start#next-steps',
},
],
},
],
'api/overview': [
{
title: 'API Overview',
href: '/docs/api/overview#api-overview',
pages: [
{
title: 'Base URL',
href: '/docs/api/overview#base-url',
},
{
title: 'Authentication',
href: '/docs/api/overview#authentication',
},
{
title: 'Response Format',
href: '/docs/api/overview#response-format',
},
{
title: 'Rate Limiting',
href: '/docs/api/overview#rate-limiting',
},
{
title: 'Best Practices',
href: '/docs/api/overview#best-practices',
},
],
},
],
'api/authentication': [
{
title: 'API Authentication',
href: '/docs/api/authentication#api-authentication',
pages: [
{
title: 'API Key Authentication',
href: '/docs/api/authentication#api-key-authentication',
},
{
title: 'Managing API Keys',
href: '/docs/api/authentication#managing-api-keys',
},
{
title: 'Best Practices',
href: '/docs/api/authentication#best-practices-for-api-key-management',
},
],
},
],
'api/endpoints': [
{
title: 'API Endpoints',
href: '/docs/api/endpoints#api-endpoints',
pages: [
{
title: 'Domain Management',
href: '/docs/api/endpoints#domain-management',
},
{
title: 'Caddy Configuration',
href: '/docs/api/endpoints#caddy-configuration',
},
{
title: 'API Key Management',
href: '/docs/api/endpoints#api-key-management',
},
{
title: 'Error Codes',
href: '/docs/api/endpoints#error-codes',
},
{
title: 'Pagination',
href: '/docs/api/endpoints#pagination',
},
],
},
],
};
1 change: 1 addition & 0 deletions content/button.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This doc will show button component
1 change: 1 addition & 0 deletions content/installation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Welcome to installation
38 changes: 38 additions & 0 deletions contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// contentlayer.config.ts
import { defineDocumentType, makeSource } from "contentlayer2/source-files";
import remarkGfm from "remark-gfm";
import { codeImport } from "remark-code-import";
import rehypeSlug from "rehype-slug";
import highlight from "rehype-highlight";

export const Post = defineDocumentType(() => ({
name: "Docs",
contentType: "mdx",
filePathPattern: `**/*.mdx`,
markdown: { fileExtensions: ["mdx", "md"] }, // Ensure it watches these files
fields: {
title: { type: "string", required: true },
description: { type: "string", required: false },
date: { type: "date", required: false },
},
computedFields: {
url: {
type: "string",
resolve: (post) => `/docs/${post._raw.flattenedPath}`,
},
slug: {
type: "string",
resolve: (doc) => doc._raw.flattenedPath,
},
},
}));

export default makeSource({
contentDirPath: "docs",
documentTypes: [Post],
mdx: {
remarkPlugins: [remarkGfm, codeImport],
rehypePlugins: [rehypeSlug, highlight],
},
disableImportAliasWarning: true,
});
15 changes: 15 additions & 0 deletions docker-compose.system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
caddycontrol:
image: itbeeazy/caddy-control:1.0.0
container_name: caddycontrol
restart: unless-stopped
volumes:
- ./db:/app/db
environment:
- NODE_ENV=production
- APP_HOST=demo.example.com
- CADDY_SERVER_IP=127.0.0.1
- CADDY_ADMIN_URL=http://localhost:2019
- JWT_SECRET=alksdlaksdjasd
network_mode: host

Loading