├── frontend ├── .env.local.example ├── .eslintrc.json ├── public │ └── images │ │ ├── hd.jpg │ │ ├── tatsu.jpg │ │ ├── wich.jpg │ │ ├── tatsu2.jpg │ │ ├── aggresive.png │ │ ├── emailsent.jpg │ │ ├── tatsumaki.jpg │ │ └── logos │ │ ├── GitHub_Logo.png │ │ ├── zendesk.svg │ │ ├── resend.svg │ │ └── joco.svg ├── src │ ├── app │ │ ├── favicon.ico │ │ ├── dashboard │ │ │ ├── billing │ │ │ │ └── page.tsx │ │ │ └── page.tsx │ │ ├── globals.css │ │ ├── layout.tsx │ │ ├── (auth) │ │ │ ├── verify-email │ │ │ │ └── page.tsx │ │ │ └── sign-in │ │ │ │ └── page.tsx │ │ └── (pricing) │ │ │ └── success │ │ │ └── page.tsx │ ├── lib │ │ ├── validators │ │ │ ├── query-validator.ts │ │ │ ├── sign-validator.ts │ │ │ ├── update-validator.ts │ │ │ └── account-credentials-validator.ts │ │ ├── types │ │ │ ├── payload-types.ts │ │ │ └── index.tsx │ │ └── utils.ts │ └── components │ │ ├── UserProvider.tsx │ │ ├── ui │ │ ├── skeleton.tsx │ │ ├── label.tsx │ │ ├── textarea.tsx │ │ ├── separator.tsx │ │ ├── progress.tsx │ │ ├── input.tsx │ │ ├── toaster.tsx │ │ ├── difficulty-badge.tsx │ │ ├── sonner.tsx │ │ ├── switch.tsx │ │ ├── badge.tsx │ │ ├── tooltip.tsx │ │ ├── borderbeam.tsx │ │ ├── avatar.tsx │ │ ├── toggle.tsx │ │ ├── scroll-area.tsx │ │ ├── toggle-group.tsx │ │ ├── tabs.tsx │ │ ├── card.tsx │ │ ├── accordion.tsx │ │ ├── Button.tsx │ │ ├── table.tsx │ │ ├── dialog.tsx │ │ ├── use-toast.ts │ │ ├── sheet.tsx │ │ ├── toast.tsx │ │ └── navigation-menu.tsx │ │ ├── ThemeProvider.tsx │ │ ├── Navbar │ │ ├── Icons.tsx │ │ ├── Navbar.tsx │ │ ├── Navitems.tsx │ │ └── MobileNav.tsx │ │ ├── UserPage.tsx │ │ ├── MaxWidthWrapper.tsx │ │ ├── Marque.tsx │ │ ├── SwitchMode.tsx │ │ ├── UpgrageButton.tsx │ │ ├── info.tsx │ │ ├── section.tsx │ │ ├── TextReavel.tsx │ │ ├── Open-source.tsx │ │ ├── Usercontext.tsx │ │ ├── faq.tsx │ │ ├── VerifyEmail.tsx │ │ ├── content.tsx │ │ ├── Testinomals.tsx │ │ ├── UserAccountNav.tsx │ │ └── billingForm.tsx ├── postcss.config.mjs ├── components.json ├── .gitignore ├── tsconfig.json ├── next.config.mjs ├── package.json └── tailwind.config.ts ├── backend ├── src │ ├── database │ │ ├── models │ │ │ ├── session.go │ │ │ ├── model.go │ │ │ ├── admin.go │ │ │ └── user.go │ │ ├── redis.go │ │ └── db.go │ ├── otp │ │ ├── mock.go │ │ └── otp.go │ ├── logger │ │ ├── logger.go │ │ └── loggrus.go │ ├── controllers │ │ └── getUsers.go │ ├── auth │ │ ├── logout.go │ │ ├── registerAdmin.go │ │ ├── login.go │ │ ├── updInfo.go │ │ └── registerUser.go │ ├── routes │ │ ├── adminRoutes │ │ │ └── admin.go │ │ ├── stripeRoutes │ │ │ └── stripe.go │ │ └── authRoutes │ │ │ └── auth.go │ ├── data │ │ ├── account.go │ │ └── status.go │ ├── router │ │ └── route.go │ ├── middleware │ │ ├── getuserid.go │ │ ├── generatejwt.go │ │ └── auth.go │ └── Email │ │ ├── templates │ │ └── verification_email.html │ │ └── mail.go ├── env.example ├── go.dockerfile ├── Makefile ├── .air.toml ├── main.go └── go.mod ├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── docker-compose.yaml └── README.md /frontend/.env.local.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="" -------------------------------------------------------------------------------- /frontend/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /frontend/public/images/hd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/hd.jpg -------------------------------------------------------------------------------- /frontend/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/src/app/favicon.ico -------------------------------------------------------------------------------- /frontend/public/images/tatsu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/tatsu.jpg -------------------------------------------------------------------------------- /frontend/public/images/wich.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/wich.jpg -------------------------------------------------------------------------------- /frontend/public/images/tatsu2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/tatsu2.jpg -------------------------------------------------------------------------------- /frontend/public/images/aggresive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/aggresive.png -------------------------------------------------------------------------------- /frontend/public/images/emailsent.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/emailsent.jpg -------------------------------------------------------------------------------- /frontend/public/images/tatsumaki.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/tatsumaki.jpg -------------------------------------------------------------------------------- /frontend/public/images/logos/GitHub_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NikoMalik/golang-nextjs-fullstack/HEAD/frontend/public/images/logos/GitHub_Logo.png -------------------------------------------------------------------------------- /frontend/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /backend/src/database/models/session.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | import "time" 4 | 5 | type Session struct { 6 | Model 7 | Token string `gorm:"unique"` 8 | UserId uint 9 | ExpiresAt time.Time 10 | } 11 | -------------------------------------------------------------------------------- /frontend/src/app/dashboard/billing/page.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | import BillingForm from '@/components/billingForm'; 4 | 5 | 6 | const Page = () => { 7 | 8 | 9 | 10 | 11 | 12 | return ; 13 | }; 14 | 15 | export default Page; 16 | 17 | -------------------------------------------------------------------------------- /backend/src/database/models/model.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | import ( 4 | "time" 5 | 6 | "gorm.io/gorm" 7 | ) 8 | 9 | type Model struct { 10 | Id uint `gorm:"primaryKey"` 11 | CreatedAt time.Time 12 | UpdatedAt time.Time 13 | DeletedAt gorm.DeletedAt `gorm:"index"` 14 | } 15 | -------------------------------------------------------------------------------- /backend/src/otp/mock.go: -------------------------------------------------------------------------------- 1 | package otp 2 | 3 | import "github.com/stretchr/testify/mock" 4 | 5 | type MockGenerator struct { 6 | mock.Mock 7 | } 8 | 9 | func (m *MockGenerator) RandomSecret(length int) string { 10 | args := m.Called(length) 11 | 12 | return args.Get(0).(string) 13 | } 14 | -------------------------------------------------------------------------------- /frontend/src/lib/validators/query-validator.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod' 2 | 3 | export const QueryValidator = z.object({ 4 | category: z.string().optional(), 5 | sort: z.enum(['asc', 'desc']).optional(), 6 | limit: z.number().optional(), 7 | }) 8 | 9 | export type TQueryValidator = z.infer -------------------------------------------------------------------------------- /backend/env.example: -------------------------------------------------------------------------------- 1 | STRIPE_KEY="" 2 | 3 | STRIPE_WEBHOOK_SECRET="" 4 | 5 | 6 | 7 | 8 | 9 | RESEND_API_KEY="" 10 | 11 | 12 | 13 | 14 | 15 | 16 | EMAIL_FROM="" 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | SMTP_SENDER="" 26 | SMTP_SERVER="" 27 | SMTP_PASSWORD="" 28 | SMTP_USERNAME="" 29 | SMTP_PORT="" 30 | -------------------------------------------------------------------------------- /backend/go.dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.22.2 2 | WORKDIR /app 3 | COPY go.mod . 4 | COPY go.sum . 5 | RUN go mod download 6 | 7 | 8 | 9 | COPY . . 10 | 11 | 12 | RUN curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 13 | 14 | 15 | EXPOSE 8000 16 | 17 | CMD ["air"] 18 | 19 | -------------------------------------------------------------------------------- /frontend/src/components/UserProvider.tsx: -------------------------------------------------------------------------------- 1 | import { PropsWithChildren } from 'react'; 2 | import { UserProvider } from './Usercontext'; 3 | 4 | const Providers = ({ children }: PropsWithChildren) => { 5 | return ( 6 | 7 | {children} 8 | 9 | ); 10 | }; 11 | 12 | export default Providers; 13 | -------------------------------------------------------------------------------- /backend/src/logger/logger.go: -------------------------------------------------------------------------------- 1 | package logger 2 | 3 | type Logger interface { 4 | Log(msg string, params map[string]interface{}) 5 | Debug(msg string, params map[string]interface{}) 6 | Info(msg string, params map[string]interface{}) 7 | Warn(msg string, params map[string]interface{}) 8 | Error(msg string, params map[string]interface{}) 9 | } 10 | -------------------------------------------------------------------------------- /frontend/src/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ) 13 | } 14 | 15 | export { Skeleton } 16 | -------------------------------------------------------------------------------- /backend/src/controllers/getUsers.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "cow-templates/src/database" 5 | "cow-templates/src/database/models" 6 | 7 | "github.com/gofiber/fiber/v2" 8 | ) 9 | 10 | func GetUsers(c *fiber.Ctx) error { 11 | var users []models.User 12 | 13 | database.DB.Where("is_user = true").Find(&users) 14 | 15 | return c.JSON(users) 16 | } 17 | -------------------------------------------------------------------------------- /backend/src/otp/otp.go: -------------------------------------------------------------------------------- 1 | package otp 2 | 3 | import "github.com/xlzd/gotp" 4 | 5 | type Generator interface { 6 | RandomSecret(length int) string 7 | } 8 | 9 | type GOTPGenerator struct{} 10 | 11 | func NewGOTPGenerator() *GOTPGenerator { 12 | return &GOTPGenerator{} 13 | } 14 | 15 | func (g *GOTPGenerator) RandomSecret(length int) string { 16 | return gotp.RandomSecret(length) 17 | } 18 | -------------------------------------------------------------------------------- /frontend/src/components/ThemeProvider.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import { ThemeProvider as NextThemesProvider } from "next-themes" 5 | import { type ThemeProviderProps } from "next-themes/dist/types" 6 | 7 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 8 | return {children} 9 | } 10 | -------------------------------------------------------------------------------- /frontend/src/lib/validators/sign-validator.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | export const SignInCredentialsValidator = z.object({ 4 | email: z.string().email(), 5 | password: z.string().min(6, { 6 | message: 'Password must be at least 6 characters long.', 7 | }), 8 | 9 | }); 10 | 11 | export type TSignInCredentialsValidator = z.infer< 12 | typeof SignInCredentialsValidator 13 | >; 14 | -------------------------------------------------------------------------------- /backend/src/auth/logout.go: -------------------------------------------------------------------------------- 1 | package auth 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/gofiber/fiber/v2" 7 | ) 8 | 9 | func Logout(c *fiber.Ctx) error { 10 | 11 | cookie := fiber.Cookie{ 12 | Name: "jwt", 13 | Value: "", 14 | Expires: time.Now().Add(-time.Hour), 15 | HTTPOnly: true, 16 | } 17 | 18 | c.Cookie(&cookie) 19 | 20 | return c.JSON(fiber.Map{ 21 | "message": "success", 22 | }) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /frontend/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } -------------------------------------------------------------------------------- /backend/src/routes/adminRoutes/admin.go: -------------------------------------------------------------------------------- 1 | package adminRoutes 2 | 3 | import ( 4 | "github.com/gofiber/fiber/v2" 5 | 6 | "cow-templates/src/middleware" 7 | ) 8 | 9 | func SetupRoutes(router fiber.Router) { 10 | admin := router.Group("/admin", middleware.IsAuthenticated, middleware.RoleMiddleware("admin")) 11 | 12 | admin.Get("/users") 13 | admin.Get("/users/:userId") 14 | admin.Put("/users/:userId") 15 | admin.Delete("/users/:userId") 16 | } 17 | -------------------------------------------------------------------------------- /backend/src/data/account.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | type Plan string 4 | 5 | const ( 6 | Free Plan = "Free" 7 | Business Plan = "Business" 8 | Pro Plan = "Pro" 9 | ) 10 | 11 | func (p Plan) String() string { 12 | return string(p) 13 | } 14 | 15 | func PlanFromString(s string) Plan { 16 | 17 | switch s { 18 | case "Free": 19 | return Free 20 | case "Business", "Business Plan": 21 | return Business 22 | case "Pro", "Pro Plan": 23 | return Pro 24 | default: 25 | return Free 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /frontend/src/components/Navbar/Icons.tsx: -------------------------------------------------------------------------------- 1 | import { LucideProps } from 'lucide-react' 2 | 3 | export const Icons = { 4 | logo: (props: LucideProps) => ( 5 | 6 | 7 | 8 | 9 | ) 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /frontend/src/components/UserPage.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { useUser } from './Usercontext'; 4 | import UserAccountNav from './UserAccountNav'; 5 | import BillingForm from './billingForm'; 6 | 7 | const UserPage = () => { 8 | const { user, loading, error } = useUser(); 9 | 10 | if (loading) return

Loading...

; 11 | if (error) return

Error: {error}

; 12 | if (!user) return

No user data available.

; 13 | 14 | return ( 15 | <> 16 | 17 | 18 | 19 | ); 20 | }; 21 | 22 | export default UserPage; 23 | -------------------------------------------------------------------------------- /backend/src/router/route.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | authRoutes "cow-templates/src/routes/authRoutes" 5 | 6 | "cow-templates/src/controllers/stripeController" 7 | 8 | stripeRoutes "cow-templates/src/routes/stripeRoutes" 9 | 10 | "github.com/gofiber/fiber/v2" 11 | "github.com/gofiber/fiber/v2/middleware/logger" 12 | ) 13 | 14 | func Setup(app *fiber.App) { 15 | api := app.Group("/api", logger.New()) 16 | 17 | api.Post("/webhook", stripeController.HandleStripeWebhook) 18 | 19 | authRoutes.SetupAuthRoutes(api) 20 | 21 | stripeRoutes.SetupStripeRoutes(api) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /frontend/src/lib/validators/update-validator.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | 3 | export const UpdateCredentialsValidator = z.object({ 4 | email: z.string().email(), 5 | password: z.string().min(6, { 6 | message: 'Password must be at least 6 characters long.', 7 | }), 8 | name: z.string().min(2, { 9 | message: 'Name must be at least 2 characters long.', 10 | }).regex(/^[A-Za-z]+$/, { 11 | message: 'Name must contain only letters.', 12 | }), 13 | 14 | 15 | }); 16 | 17 | export type TUpdateCredentialsValidator = z.infer< 18 | typeof UpdateCredentialsValidator 19 | >; 20 | -------------------------------------------------------------------------------- /backend/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | @go build -o bin/cow-templates 3 | 4 | run: build 5 | @./bin/cow-templates 6 | 7 | test: 8 | @go test ./... 9 | 10 | 11 | clean: 12 | @rm -rf bin/cow-templates 13 | 14 | .PHONY: run test clean 15 | 16 | 17 | swag: 18 | @swag init -g internal/app/app.go 19 | 20 | lint: 21 | @golangci-lint run 22 | 23 | dep: 24 | @go mod download 25 | 26 | .PHONY: dep 27 | 28 | vet: 29 | @go vet ./... 30 | 31 | air: 32 | @air 33 | 34 | 35 | up-compose: 36 | @docker-compose up -d 37 | 38 | down-compose: 39 | @docker-compose down 40 | 41 | .PHONY: up-compose down-compose -------------------------------------------------------------------------------- /backend/src/routes/stripeRoutes/stripe.go: -------------------------------------------------------------------------------- 1 | package stripeRoutes 2 | 3 | import ( 4 | "cow-templates/src/middleware" 5 | 6 | "github.com/gofiber/fiber/v2" 7 | 8 | "cow-templates/src/controllers/stripeController" 9 | ) 10 | 11 | func SetupStripeRoutes(router fiber.Router) { 12 | checkout := router.Group("/checkout", middleware.IsAuthenticated) 13 | 14 | checkout.Get("/", stripeController.HandleStripeCheckoutCreate) 15 | checkout.Get("/success", stripeController.HandleStripeCheckoutSuccess) 16 | checkout.Post("/cancel", stripeController.HandleStripeCheckoutCancel) 17 | checkout.Post("/manage-subscription", stripeController.HandleManageSubscription) 18 | 19 | } 20 | -------------------------------------------------------------------------------- /frontend/src/components/MaxWidthWrapper.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from '@/lib/utils' 2 | import { ReactNode } from 'react' 3 | 4 | const MaxWidthWrapper = ({ 5 | className, 6 | children, 7 | }: { 8 | className?: string 9 | children: ReactNode 10 | }) => { 11 | return ( 12 |
22 | {children} 23 |
24 | ) 25 | } 26 | 27 | export default MaxWidthWrapper 28 | -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./src/*"] 22 | } 23 | }, 24 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /frontend/src/lib/validators/account-credentials-validator.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod" 2 | 3 | export const AuthCredentialsValidator = z.object({ 4 | name: z.string().min(2, { 5 | message: 'Name must be at least 2 characters long.', 6 | }).regex(/^[A-Za-z]+$/, { 7 | message: 'Name must contain only letters.', 8 | }), 9 | email: z.string().email(), 10 | password: z.string().min(6, { 11 | message: 'Password must be at least 6 characters long.', 12 | }), 13 | password_confirm: z.string().min(6, { 14 | message: 'Confirm password must be at least 6 characters long.', 15 | }) 16 | }) 17 | 18 | export type TAuthCredentialsValidator = z.infer< 19 | typeof AuthCredentialsValidator 20 | > 21 | -------------------------------------------------------------------------------- /frontend/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | images: { 4 | remotePatterns: [ 5 | { 6 | protocol: "http", 7 | hostname: 'localhost:8000', 8 | 9 | 10 | }, 11 | { 12 | protocol: "https", 13 | hostname: "avatars.githubusercontent.com", 14 | }, 15 | { 16 | protocol: "https", 17 | hostname: "lh3.googleusercontent.com", 18 | }, 19 | { 20 | protocol: "https", 21 | hostname: "randomuser.me", 22 | }, 23 | ], 24 | }, 25 | 26 | 27 | }; 28 | 29 | export default nextConfig; 30 | -------------------------------------------------------------------------------- /frontend/src/lib/types/payload-types.ts: -------------------------------------------------------------------------------- 1 | export interface User { 2 | id: string; 3 | name: string; 4 | avatar?: string | null; 5 | issubscribed?: boolean | null; 6 | isCanceled ?: boolean | null; 7 | stripeCurrentPeriodEnd ?: string | null; 8 | Plan ?: string | null; 9 | 10 | role: 'admin' | 'user'; 11 | updatedAt: string; 12 | createdAt: string; 13 | email: string; 14 | resetPasswordToken?: string | null; 15 | resetPasswordExpiration?: string | null; 16 | salt?: string | null; 17 | hash?: string | null; 18 | verified?: boolean | null; 19 | verificationToken?: string | null; 20 | loginAttempts?: number | null; 21 | lockUntil?: string | null; 22 | password: string | null; 23 | } -------------------------------------------------------------------------------- /backend/src/data/status.go: -------------------------------------------------------------------------------- 1 | package data 2 | 3 | const ( 4 | StatusHealthy = "healthy" 5 | StatusExpires = "expires" 6 | StatusExpired = "expired" 7 | StatusInvalid = "invalid" 8 | StatusOffline = "offline" 9 | StatusUnresponsive = "unresponsive" 10 | ) 11 | 12 | const ( 13 | StripeStatusActive = "active" 14 | StripeStatusPastDue = "past_due" 15 | StripeStatusUnpaid = "unpaid" 16 | StripeStatusCanceled = "canceled" 17 | StripeStatusIncomplete = "incomplete" 18 | StripeStatusIncompleteExpired = "incomplete_expired" 19 | StripeStatusTrialing = "trialing" 20 | StripeStatusPaused = "paused" 21 | ) 22 | 23 | func IsPlanActive(s string) bool { 24 | return s == StripeStatusActive 25 | } 26 | -------------------------------------------------------------------------------- /backend/src/routes/authRoutes/auth.go: -------------------------------------------------------------------------------- 1 | package authRoutes 2 | 3 | import ( 4 | authController "cow-templates/src/auth" 5 | "cow-templates/src/middleware" 6 | 7 | "github.com/gofiber/fiber/v2" 8 | ) 9 | 10 | func SetupAuthRoutes(router fiber.Router) { 11 | auth := router.Group("/auth") 12 | 13 | auth.Get("/me", authController.User) 14 | auth.Post("/login", authController.Login) 15 | 16 | auth.Post("/register", authController.Register) 17 | auth.Post("/updateInfo", middleware.IsAuthenticated, authController.UpdateInfo) 18 | auth.Post("/refresh", authController.RefreshToken) 19 | 20 | auth.Post("/logout", middleware.IsAuthenticated, authController.Logout) 21 | auth.Post("/verify-email", authController.VerifyEmailHandler) 22 | auth.Post("/update-avatar", middleware.IsAuthenticated, authController.UpdateImage) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /frontend/src/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as LabelPrimitive from "@radix-ui/react-label" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 11 | ) 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )) 24 | Label.displayName = LabelPrimitive.Root.displayName 25 | 26 | export { Label } 27 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: NikoMalik 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 15 | -------------------------------------------------------------------------------- /frontend/src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes {} 7 | 8 | const Textarea = React.forwardRef( 9 | ({ className, ...props }, ref) => { 10 | return ( 11 |