Skip to content

Commit bd710cd

Browse files
committed
docs: Reorganizes structure
Restructures the documentation to improve clarity and user experience: - Renames 'guide' to 'user-guide' to better reflect its purpose. - Adds a 'developer-guide' section for contributors and advanced users. - Moves and renames files to fit the new structure. - Updates links and navigation to reflect these changes.
1 parent 29f0dbc commit bd710cd

35 files changed

+7159
-4080
lines changed

docs/.vitepress/config.ts

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,56 +30,52 @@ export default defineConfig({
3030
logo: '/logo.png',
3131
nav: [
3232
{ text: 'Home', link: '/' },
33-
{ text: 'Get Started', link: '/get-started' },
33+
{ text: 'Get Started', link: '/user-guide/getting-started' },
3434
],
3535
sidebar: [
3636
{
3737
items: [
3838
{ text: 'Get Started', link: '/get-started' },
3939
{
40-
text: 'Guide',
40+
text: 'User Guide',
4141
items: [
42-
{ text: 'Installation', link: '/guide/installation' },
43-
{ text: 'Quick Start', link: '/guide/quick-start' },
44-
{ text: 'Configuration', link: '/guide/configuration' },
45-
{ text: 'Authentication', link: '/guide/authentication' },
46-
{ text: 'Authorization (RBAC)', link: '/guide/authorization' },
47-
{ text: 'Password Reset', link: '/guide/password-reset' },
48-
{ text: 'Database Setup', link: '/guide/database-setup' }
42+
{ text: 'Overview', link: '/user-guide/index' },
43+
{ text: 'Getting Started', link: '/user-guide/getting-started' },
44+
{ text: 'Installation', link: '/user-guide/installation' },
45+
{ text: 'Configuration', link: '/user-guide/configuration' },
46+
{ text: 'Authentication', link: '/user-guide/authentication' },
47+
{ text: 'Authorization (RBAC)', link: '/user-guide/authorization' },
48+
{ text: 'Password Reset', link: '/user-guide/password-reset' },
49+
{ text: 'Components', link: '/user-guide/components' },
50+
{ text: 'Troubleshooting', link: '/user-guide/troubleshooting' }
4951
]
5052
},
5153
{
5254
text: 'API Reference',
5355
items: [
5456
{ text: 'HTTP Endpoints', link: '/api/index' },
55-
{ text: 'Types & Utilities', link: '/api/types-and-utilities' }
57+
{ text: 'Public Types', link: '/api/types' }
5658
]
5759
},
5860
{
59-
text: 'Components',
61+
text: 'Examples',
6062
items: [
61-
{ text: 'NUsersLoginForm', link: '/components/index#nusersloginform' },
62-
{ text: 'NUsersLogoutLink', link: '/components/index#nuserslogoutlink' },
63-
{ text: 'NUsersResetPasswordForm', link: '/components/index#nusersresetpasswordform' },
64-
{ text: 'NUsersList', link: '/components/index#nuserslist' },
65-
{ text: 'NUsersUserCard', link: '/components/index#nusersusercard' },
66-
{ text: 'NUsersUserForm', link: '/components/index#nusersuserform' }
63+
{ text: 'Basic Setup', link: '/examples/basic-setup' },
64+
{ text: 'Custom Components', link: '/examples/custom-components' },
65+
{ text: 'Advanced Configuration', link: '/examples/advanced-configuration' }
6766
]
6867
},
6968
{
70-
text: 'Database',
69+
text: 'Developer Guide',
7170
items: [
72-
{ text: 'Schema', link: '/database/schema' },
73-
{ text: 'Migrations', link: '/database/migrations' },
74-
{ text: 'CLI Commands', link: '/database/cli-commands' }
75-
]
76-
},
77-
{
78-
text: 'Contributing',
79-
items: [
80-
{ text: 'Development Setup', link: '/contributing/development-setup' },
81-
{ text: 'Running Tests', link: '/contributing/running-tests' },
82-
{ text: 'Guidelines', link: '/contributing/guidelines' }
71+
{ text: 'Overview', link: '/developer-guide/index' },
72+
{ text: 'Development Setup', link: '/developer-guide/development-setup' },
73+
{ text: 'Architecture', link: '/developer-guide/architecture' },
74+
{ text: 'Database Internals', link: '/developer-guide/database-internals' },
75+
{ text: 'Server Utilities', link: '/developer-guide/server-utilities' },
76+
{ text: 'Testing', link: '/developer-guide/testing' },
77+
{ text: 'Contributing', link: '/developer-guide/contributing' },
78+
{ text: 'Code Style', link: '/developer-guide/code-style' }
8379
]
8480
}
8581
]

docs/api/index.md

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# API Reference
1+
# HTTP API Endpoints
22

3-
The Nuxt Users module provides several API endpoints for authentication, user management, and password reset functionality.
3+
The Nuxt Users module provides REST API endpoints for authentication, user management, and password reset functionality. These endpoints can be used by external applications or frontend clients to interact with the authentication system.
44

55
## Authentication Endpoints
66

@@ -53,13 +53,12 @@ Logout the current user by removing their authentication token.
5353
```
5454

5555
**Notes:**
56-
- Removes the authentication token from the database
57-
- Clears the `auth_token` cookie
5856
- No authentication required (works with any valid token)
57+
- Invalidates the current session
5958

6059
## User Management Endpoints
6160

62-
Authentication and authorization are handled by middleware.
61+
These endpoints require authentication. Include your authentication token in requests.
6362

6463
### Create User
6564

@@ -102,7 +101,7 @@ Create a new user.
102101

103102
Get a user by ID. Users can only access their own profile unless they have admin permissions.
104103

105-
**Request:** No request body required (uses authentication token from cookie)
104+
**Request:** No request body required
106105

107106
**Response:**
108107
```json
@@ -199,7 +198,7 @@ Delete a user.
199198

200199
Get the current user's profile information.
201200

202-
**Request:** No request body required (uses authentication token from cookie)
201+
**Request:** No request body required
203202

204203
**Response:**
205204
```json
@@ -297,8 +296,7 @@ Send a password reset link to the user's email.
297296
```
298297

299298
**Notes:**
300-
- Always returns success message (prevents email enumeration)
301-
- Sends email only if user exists
299+
- Always returns success message for security reasons
302300
- Token expires after 1 hour
303301

304302
### Reset Password
@@ -339,36 +337,33 @@ All endpoints return consistent error responses:
339337
}
340338
```
341339

342-
## Authentication Headers
340+
## Authentication
343341

344-
For protected endpoints, include the authentication cookie:
342+
For protected endpoints, authentication is handled automatically through cookies when using the module's built-in authentication flow. External API consumers should ensure they include the authentication cookie in their requests.
345343

346-
```
347-
Cookie: auth_token=your-auth-token
348-
```
344+
## Authorization
349345

350-
The module automatically handles cookie management for login/logout.
351-
352-
## Permission System
353-
354-
The user management endpoints use a role-based permission system. Permissions can be configured to be method-specific (e.g., allowing GET but denying DELETE on the same path). See the [Authorization Guide](/guide/authorization) for more details.
346+
The API uses role-based access control:
355347

356348
- **Admin users** (`role: "admin"`) can access all user management endpoints
357349
- **Regular users** can only access their own profile via `GET /api/nuxt-users/:id`
358350
- **All users** must be authenticated to access any protected endpoint
359351

360-
## Rate Limiting
352+
For more details on configuring authorization, see the [Authorization Guide](/user-guide/authorization).
353+
354+
## Security Considerations
361355

362-
Consider implementing rate limiting for these endpoints:
356+
When using these API endpoints in production:
363357

364-
- `/api/nuxt-users/session`: Prevent brute force attacks
365-
- `/api/nuxt-users/password/forgot`: Prevent email spam
366-
- `/api/nuxt-users/password/reset`: Prevent token brute force
367-
- `/api/nuxt-users/*`: Prevent abuse of user management endpoints
358+
- Implement rate limiting to prevent abuse
359+
- Use HTTPS for all authentication-related requests
360+
- Ensure proper CORS configuration for cross-origin requests
361+
- Monitor for suspicious authentication patterns
368362

369-
## Next Steps
363+
## Related Documentation
370364

371-
- [Authentication Guide](/guide/authentication) - Learn about the authentication flow
372-
- [Authorization Guide](/guide/authorization) - Understand role-based access control
373-
- [Password Reset Guide](/guide/password-reset) - Understand password reset functionality
374-
- [Components](/components/) - Use the provided Vue components
365+
- [Authentication Guide](/user-guide/authentication) - Learn about the authentication flow
366+
- [Authorization Guide](/user-guide/authorization) - Understand role-based access control
367+
- [Password Reset Guide](/user-guide/password-reset) - Understand password reset functionality
368+
- [Components](/user-guide/components) - Use the provided Vue components
369+
- [Public Types](/api/types) - TypeScript types for API responses

0 commit comments

Comments
 (0)