@yousxlfs/next-arch 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/index.js +586 -85
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/app/package.json +25 -4
  5. package/templates/packages/better-auth/examples/src/features/_examples/with-better-auth/lib/auth-placeholder.ts +14 -0
  6. package/templates/packages/env/core/src/shared/config/env.ts +22 -0
  7. package/templates/packages/jotai/core/src/shared/providers/JotaiProvider.tsx +19 -0
  8. package/templates/packages/jotai/examples/src/features/_examples/with-jotai/README.md +3 -0
  9. package/templates/packages/jotai/examples/src/features/_examples/with-jotai/model/example.atoms.ts +19 -0
  10. package/templates/packages/motion/core/src/shared/lib/motion.ts +17 -0
  11. package/templates/packages/motion/examples/src/features/_examples/with-motion/components/ExampleMotionCard.tsx +19 -0
  12. package/templates/packages/next-intl/core/src/shared/config/i18n.ts +10 -0
  13. package/templates/packages/nuqs/examples/src/features/_examples/with-nuqs/README.md +3 -0
  14. package/templates/packages/nuqs/examples/src/features/_examples/with-nuqs/hooks/use-example-params.ts +19 -0
  15. package/templates/packages/react-hook-form/examples/src/features/_examples/with-react-hook-form/README.md +1 -0
  16. package/templates/packages/react-hook-form/examples/src/features/_examples/with-react-hook-form/components/ExampleRhfForm.tsx +40 -0
  17. package/templates/packages/redux/core/src/app/providers/redux-store.ts +15 -0
  18. package/templates/packages/redux/core/src/shared/providers/ReduxProvider.tsx +24 -0
  19. package/templates/packages/redux/examples/src/app/providers/redux-store.ts +18 -0
  20. package/templates/packages/redux/examples/src/features/_examples/with-redux/README.md +4 -0
  21. package/templates/packages/redux/examples/src/features/_examples/with-redux/model/example.slice.ts +36 -0
  22. package/templates/packages/sentry/core/src/shared/config/sentry.ts +9 -0
  23. package/templates/packages/sonner/examples/src/features/_examples/with-sonner/lib/toast.ts +7 -0
  24. package/templates/packages/sonner-provider/core/src/shared/providers/SonnerToaster.tsx +13 -0
  25. package/templates/packages/tanstack-form/examples/src/features/_examples/with-tanstack-form/README.md +3 -0
  26. package/templates/packages/tanstack-form/examples/src/features/_examples/with-tanstack-form/components/ExampleForm.tsx +60 -0
  27. package/templates/packages/tanstack-query/core/src/shared/lib/query-client.ts +24 -0
  28. package/templates/packages/tanstack-query/core/src/shared/providers/QueryProvider.tsx +30 -0
  29. package/templates/packages/tanstack-query/examples/src/features/_examples/with-tanstack-query/README.md +34 -0
  30. package/templates/packages/tanstack-query/examples/src/features/_examples/with-tanstack-query/actions/example.action.ts +34 -0
  31. package/templates/packages/tanstack-query/examples/src/features/_examples/with-tanstack-query/queries/use-example.query.ts +49 -0
  32. package/templates/packages/tanstack-table/examples/src/features/_examples/with-tanstack-table/README.md +3 -0
  33. package/templates/packages/tanstack-table/examples/src/features/_examples/with-tanstack-table/components/ExampleTable.tsx +66 -0
  34. package/templates/packages/trpc/core/src/app/api/trpc/router.ts +19 -0
  35. package/templates/packages/trpc/examples/src/app/providers/trpc-client.ts +13 -0
  36. package/templates/packages/uploadthing/core/src/app/api/uploadthing/route.ts +10 -0
  37. package/templates/packages/zustand/core/src/shared/lib/store.ts +13 -0
  38. package/templates/packages/zustand/examples/src/features/_examples/with-zustand/README.md +13 -0
  39. package/templates/packages/zustand/examples/src/features/_examples/with-zustand/model/example.store.ts +28 -0
  40. package/templates/pages/auth/src/app/({{name}})/layout.tsx +7 -0
  41. package/templates/pages/auth/src/app/({{name}})/login/page.tsx +5 -0
  42. package/templates/pages/auth/src/app/({{name}})/register/page.tsx +5 -0
  43. package/templates/pages/auth/src/entities/user/index.ts +2 -0
  44. package/templates/pages/auth/src/entities/user/lib/user-schema.ts +9 -0
  45. package/templates/pages/auth/src/entities/user/types/user.types.ts +5 -0
  46. package/templates/pages/auth/src/features/{{name}}/actions/login.action.ts +7 -0
  47. package/templates/pages/auth/src/features/{{name}}/actions/logout.action.ts +5 -0
  48. package/templates/pages/auth/src/features/{{name}}/actions/register.action.ts +7 -0
  49. package/templates/pages/auth/src/features/{{name}}/components/AuthGuard.tsx +14 -0
  50. package/templates/pages/auth/src/features/{{name}}/components/LoginForm.tsx +36 -0
  51. package/templates/pages/auth/src/features/{{name}}/components/RegisterForm.tsx +43 -0
  52. package/templates/pages/auth/src/features/{{name}}/hooks/use-session.ts +14 -0
  53. package/templates/pages/auth/src/features/{{name}}/index.ts +9 -0
  54. package/templates/pages/auth/src/features/{{name}}/lib/auth-helpers.ts +3 -0
  55. package/templates/pages/auth/src/features/{{name}}/queries/use-user.query.ts +16 -0
  56. package/templates/pages/auth/src/features/{{name}}/types/auth.types.ts +13 -0
  57. package/templates/pages/auth/src/views/{{name}}/LoginView.tsx +10 -0
  58. package/templates/pages/auth/src/views/{{name}}/RegisterView.tsx +10 -0
  59. package/templates/pages/auth/src/views/{{name}}/index.ts +2 -0
  60. package/templates/pages/blank/src/app/{{name}}/page.tsx +5 -0
  61. package/templates/pages/blank/src/features/{{name}}/index.ts +3 -0
  62. package/templates/pages/blank/src/views/{{name}}/index.ts +1 -0
  63. package/templates/pages/blank/src/views/{{name}}/{{Name}}View.tsx +8 -0
  64. package/templates/pages/crud/src/app/{{name}}/[id]/page.tsx +5 -0
  65. package/templates/pages/crud/src/app/{{name}}/new/page.tsx +5 -0
  66. package/templates/pages/crud/src/app/{{name}}/page.tsx +5 -0
  67. package/templates/pages/crud/src/entities/{{name}}/index.ts +2 -0
  68. package/templates/pages/crud/src/entities/{{name}}/lib/{{name}}-schema.ts +6 -0
  69. package/templates/pages/crud/src/entities/{{name}}/types/{{name}}.types.ts +4 -0
  70. package/templates/pages/crud/src/features/{{name}}/actions/create-{{name}}.action.ts +5 -0
  71. package/templates/pages/crud/src/features/{{name}}/actions/delete-{{name}}.action.ts +5 -0
  72. package/templates/pages/crud/src/features/{{name}}/actions/update-{{name}}.action.ts +5 -0
  73. package/templates/pages/crud/src/features/{{name}}/components/ProductCard.tsx +3 -0
  74. package/templates/pages/crud/src/features/{{name}}/components/ProductForm.tsx +5 -0
  75. package/templates/pages/crud/src/features/{{name}}/components/ProductsList.tsx +15 -0
  76. package/templates/pages/crud/src/features/{{name}}/index.ts +8 -0
  77. package/templates/pages/crud/src/features/{{name}}/queries/use-{{name}}.query.ts +10 -0
  78. package/templates/pages/crud/src/features/{{name}}/queries/use-{{name}}s.query.ts +10 -0
  79. package/templates/pages/crud/src/views/{{name}}/index.ts +1 -0
  80. package/templates/pages/crud/src/views/{{name}}/{{Name}}ListView.tsx +26 -0
  81. package/templates/pages/dashboard/src/app/{{name}}/layout.tsx +8 -0
  82. package/templates/pages/dashboard/src/app/{{name}}/page.tsx +5 -0
  83. package/templates/pages/dashboard/src/features/{{name}}/components/AnalyticsCard.tsx +8 -0
  84. package/templates/pages/dashboard/src/features/{{name}}/index.ts +1 -0
  85. package/templates/pages/dashboard/src/views/{{name}}/DashboardView.tsx +10 -0
  86. package/templates/pages/dashboard/src/views/{{name}}/index.ts +1 -0
  87. package/templates/pages/profile/src/app/{{name}}/page.tsx +5 -0
  88. package/templates/pages/profile/src/features/{{name}}/components/ProfileCard.tsx +8 -0
  89. package/templates/pages/profile/src/features/{{name}}/index.ts +1 -0
  90. package/templates/pages/profile/src/views/{{name}}/ProfileView.tsx +9 -0
  91. package/templates/pages/profile/src/views/{{name}}/index.ts +1 -0
  92. package/templates/pages/settings/src/app/{{name}}/page.tsx +5 -0
  93. package/templates/pages/settings/src/features/{{name}}/components/SettingsTabs.tsx +18 -0
  94. package/templates/pages/settings/src/features/{{name}}/index.ts +1 -0
  95. package/templates/pages/settings/src/views/{{name}}/SettingsView.tsx +10 -0
  96. package/templates/pages/settings/src/views/{{name}}/index.ts +1 -0
@@ -0,0 +1,2 @@
1
+ export type { {{Name}} } from './types/{{name}}.types';
2
+ export { {{name}}Schema } from './lib/{{name}}-schema';
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+
3
+ export const {{name}}Schema = z.object({
4
+ id: z.string(),
5
+ title: z.string().min(1),
6
+ });
@@ -0,0 +1,4 @@
1
+ export interface {{Name}} {
2
+ id: string;
3
+ title: string;
4
+ }
@@ -0,0 +1,5 @@
1
+ 'use server';
2
+
3
+ export async function create{{Name}}Action(data: { title: string }) {
4
+ return { ok: true as const, id: '1', ...data };
5
+ }
@@ -0,0 +1,5 @@
1
+ 'use server';
2
+
3
+ export async function delete{{Name}}Action(id: string) {
4
+ return { ok: true as const, id };
5
+ }
@@ -0,0 +1,5 @@
1
+ 'use server';
2
+
3
+ export async function update{{Name}}Action(id: string, data: { title: string }) {
4
+ return { ok: true as const, id, ...data };
5
+ }
@@ -0,0 +1,3 @@
1
+ export function ProductCard({ title }: { title: string }) {
2
+ return <article className="rounded border p-4">{title}</article>;
3
+ }
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+
3
+ export function ProductForm() {
4
+ return <form className="flex flex-col gap-2">CRUD form placeholder</form>;
5
+ }
@@ -0,0 +1,15 @@
1
+ import { ProductCard } from './ProductCard';
2
+
3
+ const items = [{ id: '1', title: 'Demo item' }];
4
+
5
+ export function ProductsList() {
6
+ return (
7
+ <ul className="space-y-2">
8
+ {items.map((item) => (
9
+ <li key={item.id}>
10
+ <ProductCard title={item.title} />
11
+ </li>
12
+ ))}
13
+ </ul>
14
+ );
15
+ }
@@ -0,0 +1,8 @@
1
+ export { ProductsList } from './components/ProductsList';
2
+ export { ProductCard } from './components/ProductCard';
3
+ export { ProductForm } from './components/ProductForm';
4
+ export { use{{Name}}sQuery } from './queries/use-{{name}}s.query';
5
+ export { use{{Name}}Query } from './queries/use-{{name}}.query';
6
+ export { create{{Name}}Action } from './actions/create-{{name}}.action';
7
+ export { update{{Name}}Action } from './actions/update-{{name}}.action';
8
+ export { delete{{Name}}Action } from './actions/delete-{{name}}.action';
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+
3
+ import { useQuery } from '@tanstack/react-query';
4
+
5
+ export function use{{Name}}Query(id: string) {
6
+ return useQuery({
7
+ queryKey: ['{{name}}', id],
8
+ queryFn: async () => ({ id, title: 'Demo' }),
9
+ });
10
+ }
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+
3
+ import { useQuery } from '@tanstack/react-query';
4
+
5
+ export function use{{Name}}sQuery() {
6
+ return useQuery({
7
+ queryKey: ['{{name}}s'],
8
+ queryFn: async () => [{ id: '1', title: 'Demo' }],
9
+ });
10
+ }
@@ -0,0 +1 @@
1
+ export { {{Name}}ListView, {{Name}}DetailView, {{Name}}CreateView } from './{{Name}}ListView';
@@ -0,0 +1,26 @@
1
+ import { ProductsList } from '@/features/{{name}}';
2
+
3
+ export function {{Name}}ListView() {
4
+ return (
5
+ <main className="mx-auto max-w-4xl p-8">
6
+ <h1 className="mb-4 text-3xl font-semibold">{{Name}} list</h1>
7
+ <ProductsList />
8
+ </main>
9
+ );
10
+ }
11
+
12
+ export function {{Name}}DetailView() {
13
+ return (
14
+ <main className="mx-auto max-w-4xl p-8">
15
+ <h1 className="text-3xl font-semibold">{{Name}} details</h1>
16
+ </main>
17
+ );
18
+ }
19
+
20
+ export function {{Name}}CreateView() {
21
+ return (
22
+ <main className="mx-auto max-w-4xl p-8">
23
+ <h1 className="mb-4 text-3xl font-semibold">Create {{name}}</h1>
24
+ </main>
25
+ );
26
+ }
@@ -0,0 +1,8 @@
1
+ export default function {{Name}}Layout({ children }: { children: React.ReactNode }) {
2
+ return (
3
+ <div className="flex min-h-screen">
4
+ <aside className="w-64 border-r bg-muted/30 p-4">Sidebar</aside>
5
+ <div className="flex-1">{children}</div>
6
+ </div>
7
+ );
8
+ }
@@ -0,0 +1,5 @@
1
+ import { DashboardView } from '@/views/{{name}}';
2
+
3
+ export default function Page() {
4
+ return <DashboardView />;
5
+ }
@@ -0,0 +1,8 @@
1
+ export function AnalyticsCard({ title, value }: { title: string; value: string }) {
2
+ return (
3
+ <section className="rounded-xl border bg-card p-6">
4
+ <p className="text-sm text-muted-foreground">{title}</p>
5
+ <p className="mt-2 text-3xl font-semibold">{value}</p>
6
+ </section>
7
+ );
8
+ }
@@ -0,0 +1 @@
1
+ export { AnalyticsCard } from './components/AnalyticsCard';
@@ -0,0 +1,10 @@
1
+ import { AnalyticsCard } from '@/features/{{name}}';
2
+
3
+ export function DashboardView() {
4
+ return (
5
+ <main className="grid gap-4 p-8 md:grid-cols-2">
6
+ <AnalyticsCard title="Users" value="1,234" />
7
+ <AnalyticsCard title="Revenue" value="$12,340" />
8
+ </main>
9
+ );
10
+ }
@@ -0,0 +1 @@
1
+ export { DashboardView } from './DashboardView';
@@ -0,0 +1,5 @@
1
+ import { ProfileView } from '@/views/{{name}}';
2
+
3
+ export default function Page() {
4
+ return <ProfileView />;
5
+ }
@@ -0,0 +1,8 @@
1
+ export function ProfileCard({ name, email }: { name: string; email: string }) {
2
+ return (
3
+ <section className="rounded-xl border p-6">
4
+ <h1 className="text-2xl font-semibold">{name}</h1>
5
+ <p className="text-muted-foreground">{email}</p>
6
+ </section>
7
+ );
8
+ }
@@ -0,0 +1 @@
1
+ export { ProfileCard } from './components/ProfileCard';
@@ -0,0 +1,9 @@
1
+ import { ProfileCard } from '@/features/{{name}}';
2
+
3
+ export function ProfileView() {
4
+ return (
5
+ <main className="mx-auto max-w-2xl p-8">
6
+ <ProfileCard name="Demo User" email="demo@example.com" />
7
+ </main>
8
+ );
9
+ }
@@ -0,0 +1 @@
1
+ export { ProfileView } from './ProfileView';
@@ -0,0 +1,5 @@
1
+ import { SettingsView } from '@/views/{{name}}';
2
+
3
+ export default function Page() {
4
+ return <SettingsView />;
5
+ }
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+
3
+ const tabs = ['Account', 'Notifications', 'Security'] as const;
4
+
5
+ export function SettingsTabs() {
6
+ return (
7
+ <div className="space-y-4">
8
+ <nav className="flex gap-2">
9
+ {tabs.map((tab) => (
10
+ <button key={tab} type="button" className="rounded border px-3 py-1 text-sm">
11
+ {tab}
12
+ </button>
13
+ ))}
14
+ </nav>
15
+ <p className="text-muted-foreground">Выбери вкладку и добавь формы в features/{{name}}/.</p>
16
+ </div>
17
+ );
18
+ }
@@ -0,0 +1 @@
1
+ export { SettingsTabs } from './components/SettingsTabs';
@@ -0,0 +1,10 @@
1
+ import { SettingsTabs } from '@/features/{{name}}';
2
+
3
+ export function SettingsView() {
4
+ return (
5
+ <main className="mx-auto max-w-3xl p-8">
6
+ <h1 className="mb-4 text-3xl font-semibold">Settings</h1>
7
+ <SettingsTabs />
8
+ </main>
9
+ );
10
+ }
@@ -0,0 +1 @@
1
+ export { SettingsView } from './SettingsView';